質問するログイン新規登録

質問編集履歴

1

ObjectManagar.csのコードを記載しました。

2020/02/16 06:49

投稿

muuu_u
muuu_u

スコア7

title CHANGED
File without changes
body CHANGED
@@ -10,7 +10,7 @@
10
10
  Assets/Scripts/GameManager.cs(122,74): error CS1503: Argument 1: cannot convert from 'UnityEngine.GameObject' to 'int'
11
11
  ```
12
12
 
13
- 該当のソースコード
13
+ GameManagar.cs
14
14
  ```
15
15
  using System.Collections;
16
16
  using System.Collections.Generic;
@@ -156,6 +156,41 @@
156
156
  }
157
157
  ```
158
158
 
159
+
160
+ ##ObjectManagar.cs
161
+ ```
162
+ using System.Collections;
163
+ using System.Collections.Generic;
164
+ using UnityEngine;
165
+
166
+ using UnityEngine.UI;
167
+
168
+ public class ObjectManager : MonoBehaviour {
169
+
170
+ public Sprite[] rankupPicture = new Sprite[3];//レベルアップ用のイラスト表示
171
+
172
+ // Start is called before the first frame update
173
+ void Start()
174
+ {
175
+
176
+ }
177
+
178
+ // Update is called once per frame
179
+ void Update()
180
+ {
181
+
182
+ }
183
+
184
+ //レベルアップ差分の絵を追加
185
+ public void SetLvupPicture (int level) {
186
+ GetComponent<Image> ().sprite = rankupPicture [level];
187
+
188
+ }
189
+
190
+ }
191
+ ```
192
+
193
+
159
194
  試したこと
160
195
  int型でコンバートできないというエラーなので、
161
196
  int型にあてはめられない物を何か引数で渡して代入しようとしているのかと思うのですが、