InvexGames / MaterialUI

MaterialUI is a UI kit for Unity that follows Google's official material design guidelines.
http://invexgames.com/materialUI.html
Other
771 stars 200 forks source link

Component: Toast #40

Open nah0y opened 9 years ago

nah0y commented 9 years ago

Hello!

I wanted to do a demo scene for the toasts, but it seems broken. It was working really nice before, now, when you call the Toaster.PopupToast method, it creates a huge Toast of 1000x1000. It's also really weird, because putting the Toast prefab in the scene (the one in Resources), it's 1000x1000 and I can't resize it. The only thing I can do to make it have its size back is doing a small modif, then pressing Ctrl+Z... lol

Anyway, I think the way the Toast is handled is really complex for no reason.

In conclusion, what I think is best, is add a menu where user can create a ToastManager, that will place the ToastManager gameObject correctly in the canvas (and will be the parent of the toasts). This ToastManager do not have any variable, so nothing is exposed to the inspector. It's just here to be the parent of the toasts, and initialise things. Rewrite a little the Toast classes to remove all the unnecessary code.

And the test scenes will have to call the toast via script.

If you really want to have a toast component with color, text, duration etc... exposed to the inspector, you can maybe make a ToastTrigger component that one can attach to a gameObject that has a button for example, and they will drag&drop this component in the button event method. Maybe that's not a bad idea :D

And for the last thing about toast:

PS: I don't know if you want to do it yourself, but if you want me to do it, just tell me I'll try to get into it ;)