Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class Generate : MonoBehaviour
- {
- public GameObject rocks;
- int score = 0;
- // Use this for initialization
- void Start()
- {
- InvokeRepeating("CreateObstacle", 1f, 1.5f);
- }
- // Update is called once per frame
- void OnGUI ()
- {
- GUI.color = Color.black;
- GUILayout.Label(" Score: " + score.ToString());
- }
- void CreateObstacle()
- {
- Instantiate(rocks);
- score++;
- }
- }
Add Comment
Please, Sign In to add comment