Advertisement
kadyr

Untitled

Sep 19th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Spawner : MonoBehaviour
  6. {
  7. public GameObject crystallPrefab;
  8. private float radius = 10;
  9. void Update()
  10. {
  11. if (Input.GetKeyDown(KeyCode.X))
  12. {
  13. GameObject obj = Instantiate(crystallPrefab);
  14. obj.transform.position = transform.position + new Vector3(Random.Range(-radius, radius),
  15. 0, Random.Range(-radius, radius));
  16. }
  17. }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement