ohshimatani / groupA_AcceLance

2 stars 0 forks source link

リザルト画面にてランクに応じた画像を表示する #43

Closed ohshimatani closed 2 years ago

ohshimatani commented 2 years ago

概要

イメージ

スクリーンショット 2022-07-25 113258

バックログナンバー

方針

参考資料

ohshimatani commented 2 years ago

困っていること

オブジェクト(画像)がコードで動的に生成できない。

実際のコード

public class PlanetImageManager : MonoBehaviour {

    // Resourcesファイル内のPlanetイメージ
    private Sprite planetImage;

    void Start() {
        planetImage = Resources.Load<Sprite>("Planets/Earth");
        // 画像の生成
        Instantiate(planetImage, new Vector2(0.0f, 0.0f), Quaternion.identity);
    }

}

試したこと

参考資料

  1. Resoucesファイルの中身を動的に生成
  2. オブジェクトの動的生成
  3. Sprite.Createについて
  4. Texture2DからSpriteを生成する
  5. ImageにSpriteを設定する