Guest User

For reddit my code

a guest
Jan 3rd, 2015
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class Generate : MonoBehaviour
  4. {
  5. public GameObject rocks;
  6. int score = 0;
  7.  
  8. // Use this for initialization
  9. void Start()
  10. {
  11. InvokeRepeating("CreateObstacle", 1f, 1.5f);
  12. }
  13.  
  14. // Update is called once per frame
  15. void OnGUI ()
  16. {
  17. GUI.color = Color.black;
  18. GUILayout.Label(" Score: " + score.ToString());
  19. }
  20.  
  21. void CreateObstacle()
  22. {
  23. Instantiate(rocks);
  24. score++;
  25. }
  26. }
Add Comment
Please, Sign In to add comment