Advertisement
Guest User

Untitled

a guest
May 30th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ScriptForGuy : MonoBehaviour
  5. {
  6.  
  7.     private Ray ray;
  8.     private RaycastHit rayCastHit;
  9.  
  10.     void Update ()
  11.     {
  12.         if(Input.GetMouseButtonDown(0))
  13.         {
  14.             ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  15.            
  16.             if(Physics.Raycast(ray, out rayCastHit))
  17.             {
  18.                 if (rayCastHit.transform.name == "PlayButton")
  19.                 {
  20.                     Application.LoadLevel("Main Game");
  21.                 }
  22.             }
  23.         }
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement