How can I SetParent to object with specified tag?
How can I SetParent to object with specified tag? For example transform.SetParent to gameObject.tag == "tagname" How to write this code correctly?
Comment
this won't work because there could be numerous objects with the same tag, you need a specific reference to another object's Transform in order to setParent
Answer by kskjadav007 · Apr 03, 2018 at 12:26 PM
GameObject _Go = GameObject.FindGameObjectWithTag ("_Tag");
transform.SetParent (_Go.transform);
Your answer
Follow this Question
Related Questions
How do I stop a child from taking the parent's tag? 1 Answer
transform.parent.tag not working? 1 Answer
transform.parent not working? (Unity 2d) 1 Answer
Creating an object using a prefab, with parent, text etc.. 1 Answer
Check if there's no GameObject with specific tag in the field (in the camera view) 0 Answers