17/08/11 08:49:14.56 /wXKl2Ja.net
ヒエッ書き込みミス・・・
//ctrl.cs
public class ctrl : MonoBehaviour{
public int sys00 = 1;
}
//common.cs
public class common : MonoBehaviour{
int x = 100;
}
void Update (){
Debug.Log(x);
if (this.GetComponent<ctrl>().sys00 == 1){
x = 99;
}
}
このうち、commonのif文がうまく実行できません。
・確認できていること
commonのUpdateで実行しているDebug.Logは確かにint xを返している
ctrlのint sys00の値を変更してもint xは99を返さない(実行されてない)
・できていないこと
同じゲームオブジェクト内の他のスクリプトの変数を参照できていない
・おかしいと思うところ
if (this.GetComponent<ctrl>().sys00 == 1)
こんな単純なことをと思いますが、どうぞよろしくお願いします。