Advertisement
dantepw

Chamando função de outro script

Sep 3rd, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SCRIPT 1:
  2. using UnityEngine;
  3. using System.Collections;
  4. using System.Text.RegularExpressions;
  5.  
  6. public class PlayerMenu : MonoBehaviour {
  7.  
  8.  
  9.     public GUISkin skin2;
  10.    
  11.     public bool teste = true;
  12.  
  13.     private LevelMode fase1_levelMode;
  14.  
  15.    
  16.     void Start ()
  17.     {
  18.         fase1_levelMode = GetComponent <LevelMode> ();
  19.     }
  20.  
  21.  
  22.     void OnGUI()
  23.     {
  24.         GUI.skin = skin2;
  25.         if (GUI.Button (new Rect (200, 400, 200, 50), "Teste"))
  26.         {
  27.             fase1_levelMode.callGameMode1 ();
  28.             teste = false;
  29.         }
  30.     }
  31. }
  32.  
  33. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SCRIPT 2:
  34.  
  35. using UnityEngine;
  36. using System.Collections;
  37. using System.Text.RegularExpressions;
  38.  
  39. public class LevelMode : MonoBehaviour {
  40.  
  41.     PlayerMenu pm;
  42.  
  43.     public void callGameMode1 ()
  44.     {
  45.         print ("teste");
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement