com.unity.perception icon indicating copy to clipboard operation
com.unity.perception copied to clipboard

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

Open ComeOnAndSam opened this issue 4 years ago • 1 comments

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.

ComeOnAndSam avatar May 28 '21 18:05 ComeOnAndSam

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 { }

mkamalza avatar Jun 09 '21 00:06 mkamalza