1 using UnityEngine;
2 using
System.Collections;
3 using
UnityEngine.SceneManagement;
4
5 public
class PlayAgain : MonoBehaviour {
6
7     
// Use this for initialization
8     
void Start () {
9
10     }
11     
12     
// Update is called once per frame
13     
void Update () {
14
15         
if (Input.GetMouseButtonDown(0))
16         {
17             Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
18             RaycastHit hit;
19             
if (Physics.Raycast(ray, out hit))
20             {
21                 
//Play Again
22                 
if (hit.transform.name == "btnPlayAgain")
23                 {
24                     SceneManager.LoadScene(
"CatRunGame");
25                 }
26
27                 
//Back to Main Screen
28                 
if (hit.transform.name == "btnBack")
29                 {
30                     SceneManager.LoadScene(
"MainScene");
31                 }
32             }
33         }
34
35     }
36 }


Use this for initialization

Update is called once per frame

Play Again

Back to Main Screen



Gõ tìm kiếm nhanh...