回答編集履歴
1
編集
answer
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
「.GetComponent<GameObject>()」の部分は不要です。
|
6
6
|
「GameObject.Find("Center")」の部分が、GameObjectを返してくれるので。
|
7
7
|
|
8
|
+
|
8
9
|
**その他の問題と思われる点**
|
9
10
|
1、「Center.transform.Find("Sphere").GetComponent<GameObject>();」の部分も誤っております。
|
10
11
|
こちらも「GetComponent」する必要はありません。
|
@@ -13,7 +14,12 @@
|
|
13
14
|
2、「if (Sphere == true)」だと正常にActive判定できないと思われます。
|
14
15
|
「activeSelf」という、オブジェクトの状態を返してくれるプロパティがあるので、こちらを利用してはいかがでしょうか。
|
15
16
|
|
17
|
+
**参考URL**
|
18
|
+
- [Unityドキュメント / GameObject.Find](https://docs.unity3d.com/ja/current/ScriptReference/GameObject.Find.html)
|
19
|
+
- [Unityドキュメント / Transform.Find](https://docs.unity3d.com/ja/current/ScriptReference/Transform.Find.html)
|
20
|
+
- [Unityドキュメント / GameObject-activeSelf](https://docs.unity3d.com/ja/2018.4/ScriptReference/GameObject-activeSelf.html)
|
16
21
|
|
22
|
+
|
17
23
|
**サンプルソース**
|
18
24
|
```diff
|
19
25
|
using System.Collections;
|