質問編集履歴
1
「試したこと」を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -55,9 +55,35 @@
|
|
55
55
|
型「GameObject」を変更するとそもそもプレハブをアタッチできません。
|
56
56
|
|
57
57
|
`testIndex = testAttach.IndexOf(_TestPrefabs);`の記法や使い方が誤っていることは何となく解るのですが、
|
58
|
-
どう修正していいかわかりません
|
58
|
+
どう修正していいかわかりません。
|
59
59
|
|
60
|
+
`testIndex = _TestPrefabs.IndexOf(testAttach);`
|
61
|
+
では
|
62
|
+
`error CS1501: No overload for method 'IndexOf' takes 1 arguments`
|
63
|
+
というエラーとなりました。これは恐らく「IndexOfは合ってるけど引数が変だよ」という意味かな…と思います。
|
64
|
+
そこで引数を変えて試してみたところ、
|
60
65
|
|
66
|
+
`testIndex = _TestPrefabs.IndexOf(testAttach,object);`
|
67
|
+
`testIndex = _TestPrefabs.IndexOf(object,testAttach);`
|
68
|
+
では
|
69
|
+
`error CS1525: Invalid expression term 'object'`
|
70
|
+
というエラーとなり、
|
71
|
+
|
72
|
+
`testIndex = _TestPrefabs.IndexOf(testAttach,GameObject);`
|
73
|
+
`testIndex = _TestPrefabs.IndexOf(GameObject,testAttach);`
|
74
|
+
では
|
75
|
+
`error CS0119: 'GameObject' is a type, which is not valid in the given context`
|
76
|
+
というエラーとなり、
|
77
|
+
|
78
|
+
`testIndex = _TestPrefabs.IndexOf(testAttach,0);`
|
79
|
+
`testIndex = _TestPrefabs.IndexOf(testAttach,1);`
|
80
|
+
`testIndex = _TestPrefabs.IndexOf(0,testAttach);`
|
81
|
+
`testIndex = _TestPrefabs.IndexOf(1,testAttach);`
|
82
|
+
では
|
83
|
+
`error CS1503: Argument 1: cannot convert from 'UnityEngine.GameObject' to 'System.Array'`
|
84
|
+
というエラーとなるようです。
|
85
|
+
|
86
|
+
|
61
87
|
### 補足情報(FW/ツールのバージョンなど)
|
62
88
|
|
63
89
|
Unity 2020.3.14f1(LTS)
|