- Home /
Linking 2 script variables (min + max) to one editor bar - MinMaxSlider?
Is there a way to highlight the link between 2 script variables so that the editor will display them in a linked (min/max) fashion?
So instead of this display in the editor:
SpawnTimeMin : 5
SpawnTimeMax : 8
LeashDistMin : 15
LeashDistMax : 35
I would have something like
SpawnTimeMin / SpawnTimeMax : 5-8
LeashDistMin / LeashDistMax : 15-35
In my scripts I have a lot of dual variables for min and max, for example SpawnTimeMin SpawnTimeMax, LeashDistMin, LeashDistMax. Depending on a monster type these variables are different and i'd like to set them in the editor.
At the moment I'm simply having to change 2 numbers, but I noticed there is a nice built in bar called MinMaxSlider, where you can change 2 numbers with only 1 row, and it gives you a nice visual explanation of the values. Is this something I can somehow take advantage of?
Yes, indeed it is- but you'll need to create a custom editor to be able to use it. In most cases, it's more trouble than it's worth, but on the other hand, if you're up to the (reasonably straightforward) challenge, it's useful to know how to do.
That does sound like more trouble than it's worth. However, out of interest, what would the general process be? Would I have to define my own parser to detect a certain new keyword or struct?
I was hoping for something along the lines of:
var SpawnTime$$anonymous$$in : float;
var SpawnTime$$anonymous$$ax : float;
@link SpawnTime$$anonymous$$in, SpawnTime$$anonymous$$ax;
I guess I could make a class / struct that contains $$anonymous$$ and max variables then have the editor have a custom slider to represent that struct / class type or something?