Turning Off Only One Instance of a Script

Hi,

I am trying to turn off a script component on one instance of an object. My issue is that when I turn off the script component that script is then turned off for all instances of that game object. I want the game object to still be visible in the world so I am using enable to turn off the component. I’ve been searching all day and can’t seem to find an answer that is relevant to my problem.

Things I have tried:

  • Unpacking the prefab
  • Turning the off the component via the game object and the parent object

I’m still very new to game development so please forgive me if I’ve missed something obvious. Thank you in advance for any help!

Hi @tommydcooley, it might help to post your code for how you are disabling the component. Have you tried something like this:

myGameObject.GetComponent<myClass>().enabled = false;

Where myGameObject points to the instance you’re talking about and myClass is the name of your class.