Hi, I’m making my first 2D game. I’m working on the UI - making some buttons designs to reuse in the game.
The problem is, the Button component that Unity offers by default can only animate a single graphic, and cannot animate the text inside of it.
That’s why I would like to create my custom button class from scratch, so that it can interact with an Animator Controller component and give me complete control over the aesthetics of the button.
I’m pretty sure I can recreate what I need for the button to work, but how do I implement the Navigation system on my custom class?
If you use the default Button component Unity offers you a couple different types of navigation, and also shows you some nice graphical effects with all the arrows showing the flow of the navigation.
I tried simply expanding the button class, the problem is, using a derived Button class completely messes up the custom inspector that the Button comes with.
I didn’t know the source code for the editors was online. I tried subclassing a custom editor from Editor and then overriding etc. but the editor was glitched anyway.
Apparently I have to subclass from ButtonEditor. Thanks!
I just noticed that the code for all that magical Navigation stuff is right here in the SelectableEditor script. I know that the Unity source code is on a reference-only license, but can I copy the parts of code that I need to recreate the navigation button and graphic arrows from the source code into my custom editor class? Would that be a violation?