Question by
melon_studio · Apr 24, 2021 at 11:43 PM ·
instantiatetagging
Can you modify tags in unity using scripts alone?
Tags are useful, but sometimes you just need to modify tags on gameobjects duplicated with the instantiate command. Can anyone show me the way?
Comment
Best Answer
Answer by disuperguy · Apr 25, 2021 at 12:36 AM
If you have access to the code where the GameObject was instantiated then do this:
var obj = Instantiate(gameObject);
obj.tag = "tagName";
Your answer
![](https://koobas.hobune.stream/wayback/20220613032814im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Using constructors in Unity (C#) 8 Answers
Performance of instantiate and destroy for bullets 2 Answers
Instantiate objects around a sphere 2 Answers
More problems with arrow shooting 0 Answers
Instantiation of my GameObjects spell (from other script) 0 Answers