I’ve a instantiate prefab with a car, and i have a game manager always in scene.
When i instantiate the first prefab, game manager found by name the prefab script, but when destroy prefab and instantiate a new prefab clone, the script are missing and it’s impossible to found by name or tag.
prefab is instatiate fine, but on the game manager the script is missing, after destroy.
I will try to found it after instantiate the second time but doens’t work.
public void testme()
Supercars = Instantiate (car, new Vector3(-40, -14, -17), Quaternion.Euler(0, 90, 0));
Supercars.name = "Car03";
WC = GameObject.FindGameObjectWithTag("Respawn").GetComponent<VehicleBehaviour.WheelVehicle>();
car = GameObject.FindGameObjectWithTag("Respawn");
are you linking the prefab in folder to the manager prefab in folder and not in scene?
no the link is between car prefab(in scene) and game manager (in scene).
And your loading a prefab from File? No, no, you need to link the prefabs in file together, so it cannot be lost. if not linked that way the One instance in scene gets destroied and if the object in scene goes there is no actual reference to it anymore… Then the manager must be an instance of the prefab in file. I learned this making Editors and Editor Windows. If not done this way the EditorWindow throws a continuous null reff error once the reff is missing…Good way to test if your doing things correctly