Toggle function

#5 · closed · 5 comments

View on GitHub ↗

marvpaul

I often add this method to your UIController class to toggle between show and hide. Not sure if it fit's to the hole concept of the asset, but for simple show & hide animations it works very well for me. I would love to see it in the project, so I don't need to add it each time I import your asset and also I could imagine a lot of other users would use it as well. `public virtual void Toggle() { if(this.isShow){ Hide(); } else { Show(); } }`

Comments

johnsoncodehk

Do you know you can inherit to expand your own function, and you still want to include it in UIController.cs? ```cs public class MyUIController : UIController { public virtual void Toggle() { if(this.isShow){ Hide(); } else { Show(); } } } ``` For code design, this is a redundant function for UIController.cs, but yes, this is good for DX. and I am considering. btw I don’t know this package still has user :sweat_smile:

johnsoncodehk

I have send a invite to you to be collaborator, actually my work leaved Unity long time, I think it is more reasonable let current users to maintain.

marvpaul

Okay alright, thanks for the fast response. Unfortunately I don't have much time and ideas for improvements. I could have an eye on the project and see if there are any issues coming up here in Github.

johnsoncodehk

@marvpaul you can decide add the `Toggle()` feature or other change, and commit now. :)

johnsoncodehk

btw when I free I will update to remove `unity-animator-override-controller-extras` depend, because this is not a good design.