I have problem with method GameObject.Find().
When my player was in basic scene everything were ok, but when i started using DontDestroyOnLoad() game show error:
ArgumentException: The Object you want to instantiate is null.
UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:239)
UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:151)
UnityEngine.Object.Instantiate[GameObject] (UnityEngine.GameObject original, Vector3 position, Quaternion rotation) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:206)
Equipment.ToLoad (System.Collections.Generic.Dictionary`2 item, UnityEngine.GameObject itemSlotLoad) (at Assets/Tiled2Unity/Scripts/Equipment.cs:504)[…]
I tried to solve this with Debug.Log(), and i found out that the problem is in that lane:
GameObject type = GameObject.Find(item["Item name"]); GameObject itemClone = GameObject.Instantiate(type, itemSlotLoad.transform.position, Quaternion.identity) as GameObject;
itemClone can’t Instatiate object, because “type” can’t be found.
Is it possible, that Script attached to DontDestroyOnLoadObject can’t find Non(?)DontDestroyOnLoadObcject ?