Programmers learn & share
+1 vote
61 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)   | 61 views

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 (36.1k points)  
2,187 questions
2,514 answers
59 comments
241 users