Hi,
I’m new to editor scripting and I have a case where I need to overload unity’s toggle component so that when something is toggled it can return an int ID.
I want to used this in on different things. I’m making a character creator so in this case on gender, background, perks etc… So I want to be able to pick an enum to be displayed in the inspector. Or alternatively make multiple editor script and be able to pick which one unity uses on a case by case basis.
Are any of this things possible?
I wouldn’t use that approach. It’s gonna require endless future support if the Toggle component changes in the future.
Instead, simply attach a MonoBehaviour to the same GameObject as the Toggle and have it “watch” the toggle so that it can signal what happened / when / why / what.
For instance, I do this in my Datasacks package, when you want to receive input from a Toggle:
Far simpler and doesn’t require you to get into Toggle’s dirty laundry pile.
1 Like