我有一個(gè)包含此代碼的 MonoBehaviour; private void OnTriggerEnter(Collider other) { Debug.Log(other.name); }當(dāng)我編譯此代碼時(shí),我收到此錯(cuò)誤:Script error: OnTriggerEnterThis message parameter has to be of type: ColliderThe message will be ignored.即使 MonoBehaviour 沒有在任何地方使用,情況也是如此。(通過代碼添加)添加它的代碼: private void SpawnItem(Vector3Int pos) { new GameObject().AddComponent<ItemGameobject>().Initialize(pos, new Item(GetBlockTypeAt(pos), 1)); }
Unity3D編譯時(shí)出現(xiàn)Script error: OnTriggerEnter
哆啦的時(shí)光機(jī)
2023-08-13 10:12:29