How would you make a box like a button?

Im trying to make a pause button …

I don’t understand at all what you’re asking about. “How would you make a box like a button?” is the subject, then you say you’re trying to make a pause button. What exactly are you after? Have you read any of the GUI Scripting Guide?

So im trying to make it so when you press the pause button, it goes to another scene.

if( GUILayout.Button( "Pause" ) )
{
   Application.LoadLevel( "Level name" );
}

I don’t see how this is pausing anything though - as loading a new level will unload the old one and all your GameObject and components as well.

And I’m also still not clear on what the thread title has to do with your stated question of interest. “Box like a button”? :stuck_out_tongue:

Either way, Emil answered it above. Simple button to go to a new level. Have fun!

I’ve been trying to something that may be similar. Instead of using a button, I want to use a 2D Texture that fires a change when clicked. This is easy enough - you just use the OnMouseDown, OnMouseOver, etc. functions that come with the GUITexture.

I’d also like the image displayed to be different when the mouse hovers over it, but when I try to reassign the texture, the console tells me it’s read-only. So, I think my options are:

  1. Use GUI.XXX to display the image (which I can then change), and manually detect where the mouse is on each update cycle.

  2. Place the two GUITextures in the same place, and use OnMouseOver to enable one and disable the other as appropriate

  3. Use GUI Skins to fake switching between the images, as one is just a highlighted version of the other.

What do y’all think is the best way to do this? If it makes any difference, my GUI will have 16 of these ‘buttons’ displayed in an arc, and none are a convenient shape (they’re teeth).

Thanks,
Dan

Use UnityGUI and either set the hover state in the GUISkin (applies to all elements of the affected type) or make a custom GUIStyle with the hover state set (applied on a per-control basis) to get the rollover behavior you want.

GUISkins and GUIStyles are meant for this. :slight_smile:

Thanks! That makes a lot of sense :slight_smile: