Question by
HiddenChicken · Nov 24, 2021 at 11:45 AM ·
instantiateparenting
Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption
Hi guys, I am facing this problem again and again. I cannot find solution. I think my code is right, but where is the problem?
GameObject visual = Instantiate<GameObject>(placementObject[num], hit.point + visualOffset, Quaternion.identity);
visual.transform.SetParent(parentObject.transform);
I got error message on this line -> visual.transform.SetParent(parentObject.transform);
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613045723im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity server/client player attachments parenting 1 Answer
bullet holes parenting 1 Answer
How to set instantiated game object as child on collision in C# 0 Answers
What's the best way to instantiate plants? Procedural Generation World 1 Answer
Why are my bullets instantiating as children of the player? 0 Answers