Create a custom GUI for a NPCTalk Script

Hello! i found a script on the internet that allows me to attach it to a NPC in my game, and then when it’s within a certain range of my character, it well prompt me with a message box to press the NPC to receive an additional message!

My question is! how do i make a custom GUI so that the box will look a bit more interesting…for example the rectangle was like a piece of parchment or something like that?

If were you, I would wait for [Unity 4.6][1] You can also test it out right now but it's still in beta. [1]: http://unity3d.com/unity/beta/4.6

1 Answer

1

What you’re looking for is a GUISkin. You can create these yourself and there is very little editing needed, just one line of code:

GUI.skin = MySkin;

This must be placed before any GUI elements you want to use the style on, so in your case placing it at the start of OnGUI would work just fine. You can set your GUI elements to have background images using the Normal and Hover properties etc.

Read the GUISkin entry on the Unity Manual website for more information.

[32796-sheep_gui.png|32796] Well i managed to get it working! I like it but i feel like it come be made to look a lot better! Any suggestions :')?