###ランダムにオブジェクトの形成
Unity2Dで中央から4種類の靴下のうち一つがランダムに現れて、その柄によって四方のカゴに仕分けるというゲームを作っています。prefabを用いて中央からオブジェクトを形成する機能の実装中に以下のエラーメッセージが発生しました。
###発生している問題・エラーメッセージ
The`.'operator cannot be applled to operand of type`method group' The name`number'does not exist in the current context Cannot apply indexing with [] to an expression of type`method group' Expression denotes a`type',where a`variable',`value' or`method group's expected The type`<error>'cannot be used as type parameter`T' In the generic type or method`UnityEngine.Object.Instiate<T>(T,UnityEngine.Vector3,UnityEngine.Quaternion)`.There is no implicit reference conversion from`<error>'to`UnityEngine.Object'
###該当のソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; public class atarihanntei : MonoBehaviour { //靴下のPrefab public GameObject SOX1; //靴下の作成 public void SOX(Transform origin) { number = Random.Range (0, SOX.Length); Instantiate(SOX[number],Vector3(0.0f, 2.0f, 0.0f),Quaternion.identity); } }
###試したこと
http://qiita.com/maki0321/items/cb01fb4ee8cf0a6bbafe
ここのサイトを参考に作っていました。でもどうしてもnumberでエラーが出ます。
###補足情報(言語/FW/ツール等のバージョンなど)
C# Unity5
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/20 13:40