|Submited on :||Tue, 14th of May 2019 - 18:04:01 PM|
|Post ID :||bogx63|
|Post Name :||t3_bogx63|
|Post Type :||link|
|Subreddit Type :||public|
|Subreddit ID :||t5_2qwj8|
If you're going to use it as a range you should probably make your own serializable struct instead of reusing Vector2 without any clear indication of what X and Y are. Then you could target the property drawer at that struct so you don't need an attribute and you could add various relevant methods like Clamp, Random, etc.
That's what I noticed too. Vector2 has a lot of operations which only make sense when you're dealing with points. Just create your own Range struct with a float for Min & Max and use that instead.
Honestly this is most useful for me when I'm passing off my things to designers who don't know the code, but still want to edit parameters.
Custom Editor for something of type T that is represented in the editor as V2, but is represented according to type T where T conforms to the interface that accepts a minimum and a maximum. It’ll save you time.
Is this different to the built-in
RangeAttribute clamping a single value, float or int.
This MinMax attribute is for a Vector2 it seems.
Though I would keep most min max values as seperate floats instead of incorrectly using Vector2.
That tag tho
Hello! Here's my Unity tip #31: You can use the 'MinMax' attribute I wrote to better edit "random Vector2s" in the Inspector.
See you around, have a nice day!
Isn’t that the exact same as the one from NaughtyAttributes?
I wanna know what ALL of these code annotations are.
this one is not a default one. you can get more of these downloading an extension.
It looks like Visual Studio 2019. You can download the 2019 Community edition for free.
It looks to be in Rider by Jetbrains.
The only thing I don't like about that is that you can't type in exact values, if that's what you need to do at the moment.
Wow, that must be really great for making scripts that developers will use who know nothing about where the range should be! I really like that! Thanks for showing that, it is very cool!
New to unity programming, what does this do?
Can you make a tutorial on how to find names for tag and layer ? I see you do it pretty well
attributes are commonly underutilized in projects