how to parent an instantiated gameobject?

hi,

i have a multiplayer fps with cars. instatiate the player works fine but whenever your trying to get in the car, it cant parent. I tryed a lot of things, but nothing seems to work. it’s keep giving the error: “Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
UnityEngine.Transform:set_parent(Transform)”. is there a way to do this?

here is the parent-part of my script(in csharp):

public  Transform playertrans; 

playertrans.parent = transform; // group the instance under the car
			playertrans.localPosition = Vector3.zero; // make it at the exact position of the car
			playertrans.localRotation = Quaternion.identity; // same for rotation

playertrans appears to be a reference to your prefab. You can’t set the parent of a prefab, because a prefab isn’t an instantiated object, and actually if you were allowed to set the parent from code, it would become an invalid reference once the game stopped. Your code is correct in setting a parent, but you just need to set the parent of the instantiated object instead (that is the return value of the Instantiate() method call).