Answer the question
In order to leave comments, you need to log in
There is a GUI.Button in Unity3D, how to "dress" a sprite on it?
Hello! The problem is the following. There is a casual game created in Unity3D.
There is a script in C #, with the help of which the sound is turned off / on in the game. The question is, how to "dress" a sprite on a standard GUI.Button button? Now it looks like a regular gray rectangle, but I need my image to be. Below is the script:
using UnityEngine;
using System.Collections;
public class Hui : MonoBehaviour {
public bool CanMute;
void Start() {
CanMute = true;
}
void OnGUI()
{
if (GUI.Button (new Rect (Screen.width - ((Screen.width / 60) * 2) - (Screen.width / 20 * 2), Screen.height / 60, Screen.width / 20, Screen.width / 20), "[email protected]"))
{
if (CanMute)
{
AudioListener.pause = true;
CanMute = false;
}
else
{
AudioListener.pause = false;
CanMute = true;
}
}
}
}
Answer the question
In order to leave comments, you need to log in
docs.unity3d.com/Manual/class-GUIStyle.html
If possible, it's better to switch to Unity 4.6 , it's much easier to do there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question