- Home /
Using sprites as GUI
I have a sheet of interface elements that I want to use as GUI but how can I use the sprites in my code? I've used the sprite editor set it to multiple etc. but how can I use this in my code? when I drag them into my sprite variable it just displays the whole sheet.
Thanks,
Jan Julius.
Why don't you drag sprites on the scene, make GUI look as you wish and detect click on them when needed?
It is very easy to use and works great on mobile. It is among the top selling assets on the store and support is great too.
There's also 2Dtoolkit, but that is more than just GUI tool. I bought NGUI because i found a book on it. The book is for an outdated version of NGUI, but good to understand the tool.
Oh I see, I'm unable to purchase anything though and am stuck with the assets I receive, I programmed it with the old system like I did with a lot of my previous games just the regular GUI that's installed with Unity but my project leader gave me a sheet full of sprites whom I had to cut out with the sprite editor, but I'm rather clueless and don't really know what to do with a few things as in placing stars for finishing a level, my old method was just looping through and adding a star for ever loop a few 10s of coordinates away but I have no idea how I would be doing that now.
Thanks.
Answer by SanSolo · Nov 11, 2014 at 11:11 AM
You'd need a GUI manager anyway to handle multiple resolutions. So i'd recommend NGUI. It has Atlas maker where you can create an atlas from your images and use them for GUI.