test1 というスクリプトでbool値を宣言し、trueを代入しているのに、test2ではfalseになります。
test1
1public class test1 : MonoBehaviour 2{ 3 public bool testBool; 4 5 6 void Start() 7 { 8 testBool = true; 9 }
test2
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class test2 : MonoBehaviour 6{ 7 private test1 boolnum; 8 9 10 void Start() 11 { 12 boolnum = FindObjectOfType<test1>(); 13 Debug.Log(boolnum.testBool); 14 //falseがかえってくる。 15 }
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/23 10:23
2019/08/23 16:06