質問編集履歴
2
題名の具体化
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
unity オブジェクトがfalseの場合、違うオブジェクトをfalseにしたい(二度目)
|
1
|
+
unity activeslfにて、オブジェクトがfalseの場合、違うオブジェクトをfalseにしたい(二度目)
|
body
CHANGED
File without changes
|
1
追記
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
unity オブジェクトがfalse
|
1
|
+
unity オブジェクトがfalseの場合、違うオブジェクトをfalseにしたい(二度目)
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
https://teratail.com/questions/62810
|
1
|
+
(https://teratail.com/questions/62810)
|
2
2
|
からの派生なのですが、うえのURLから、回答を頂き、以下のソースを書いたところ以下のエラーが出ました
|
3
3
|
```C#
|
4
4
|
using System.Collections;
|
@@ -26,4 +26,32 @@
|
|
26
26
|
Doorscript.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Script/Doorscript.cs:14)
|
27
27
|
|
28
28
|
と出てしまいます。
|
29
|
-
どなたか解決方法を教えて下さい。
|
29
|
+
どなたか解決方法を教えて下さい。
|
30
|
+
|
31
|
+
追記
|
32
|
+
上記のソースを以下のソースにかえてみましたが、変化なしでした。
|
33
|
+
```C#
|
34
|
+
using System.Collections;
|
35
|
+
using System.Collections.Generic;
|
36
|
+
using UnityEngine;
|
37
|
+
|
38
|
+
public class Doorscript : MonoBehaviour {
|
39
|
+
|
40
|
+
// Use this for initialization
|
41
|
+
void Start () {
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
// Update is called once per frame
|
46
|
+
void OnTriggerEnter ( Collider other ) {
|
47
|
+
if (GameObject.Find ("Key").gameObject.activeSelf)
|
48
|
+
{
|
49
|
+
GameObject.Find("DoorA").gameObject.SetActive(false);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
```
|
54
|
+
ちなみに、このスクリプトは、まず違うスクリプトでプレイヤーと衝突したら、"Key"をfalseにして、そのKeyがfalseの場合に、ドアとぶつかったら、そのドアをfalseにする。
|
55
|
+
といったのもです。
|
56
|
+
|
57
|
+
追記終了
|