DNP_CubeSpawner.cs 627 B

12345678910111213141516171819202122232425
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DamageNumbersPro.Demo
  5. {
  6. public class DNP_CubeSpawner : MonoBehaviour
  7. {
  8. public float delay = 0.2f;
  9. public GameObject cube;
  10. void Start()
  11. {
  12. InvokeRepeating("SpawnCube", 0, delay);
  13. }
  14. void SpawnCube()
  15. {
  16. GameObject newCube = Instantiate<GameObject>(cube);
  17. newCube.SetActive(true);
  18. newCube.transform.SetParent(transform, true);
  19. newCube.transform.localScale = Vector3.one;
  20. }
  21. }
  22. }