Unity-Technologies / com.unity.perception

Perception toolkit for sim2real training and validation in Unity
Other
918 stars 177 forks source link

RandomizerTag script arrays can not be multi-filled in the inspector like monobehaviour arrays #325

Open ComeOnAndSam opened 3 years ago

ComeOnAndSam commented 3 years ago

I have a RandomizerTag with a public array that I want to fill with around 200 GameObjects from my scene. In monobehaviour scripts, this can be alleviated by just selecting all the gameobjects you want to add and dragging them to the array's name in the inspector. But on a RandomizerTag component, that is not possible. With so many elements to fill, I need to now make a monobehaviour script that serves no purpose but to hold an array and then read it into my RandomizerTag script, or do something hacky with the ExecuteAlways tag, all because it's missing this functionality.

mkamalza commented 3 years ago

The reason behind this behavior is that RandomizerTags by defualt use a custom editor that allows for Parameters to display the same UI that they have when they are used in Randomizers. This helps unify UI across the Randomization system.

But you can bypass this custom inspector for your own RandomizerTags by creating a new empty custom editor for them. For instance, if the tag is called MyRandomizerTag, create this class anywhere in your project under a folder named "Editor":

[CustomEditor(typeof(MyRandomizerTag))]
class MyRandomizerTagEditor : Editor { }