• Register
Welcome to Kodlogs, programming questions and answer website.
+1 vote
20 views

Problem :

Looking for the solution on bellow problem
setting the parent of a transform which resides in a prefab is disabled to prevent data corruption
by (6.9k points)  

1 Answer

0 votes

Solution :

You must confirm if your "transform" variable is actually from a gameobject and not from a prefab.

var transform = somePrefab.transform;
enemy.transform.parent = transform; // this will not work

var transform = someOtherGameObject.transform;
enemy.transform.parent = transform;
// this will work
by (33.3k points)  
...