Advertisement
tinyevil

Untitled

Dec 11th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ExampleClass : MonoBehaviour {
  5. public Texture btnTexture;
  6. void OnGUI() {
  7. if (!btnTexture) {
  8. Debug.LogError("Please assign a texture on the inspector");
  9. return;
  10. }
  11. if (GUI.Button(new Rect(10, 10, 50, 50), btnTexture))
  12. Debug.Log("Clicked the button with an image");
  13.  
  14. if (GUI.Button(new Rect(10, 70, 50, 30), "Click"))
  15. Debug.Log("Clicked the button with text");
  16.  
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement