"currentPeople.timeCount;"の値を取得する方法を教えてください は、たとえば、私は、スクリプトを持っている:ゲームオブジェクトの作成方法を1つのパラメータ(c#)で指定しますか?
public class BuildingPlacement : MonoBehaviour
{
public GameObject currentPeople;public int DelayTime;private int timeCount;
}
私は
DelayTime = currentPeople.timeCount;
ことを言いたい場合、私は以下のコードを試してみて、それがオブジェクトのインスタンスに設定されていないとNullReferenceExceptionのオブジェクト参照言う:
DelayTime = (BuildingPlacement)currentPeople.GetComponent(typeof(BuildingPlacement).timeCount);
currentPeople.timeCount
の値を取得するにはどうすればよいですか?出来ますか?
ここに質問とコードを投稿してください。画像のように質問をアップロードしないでください – Programmer
修正のおかげで、最初にstackoverflowを使用して笑 –
それはそうですか?私は最初にGameObject currentPeopleはcurrentPeople.timeCountを持っていませんが、currentPeople.timeCount、 –