using System.Collections; using System.Collections.Generic; using UnityEngine; public class GenBall : MonoBehaviour { GameObject goBall; public GameObject pfBall; public Transform spawnPoint; // Use this for initialization void Start () { goBall = Instantiate(pfBall, spawnPoint.position, spawnPoint.rotation); } // Update is called once per frame void Update () { } void OnTriggerEnter(Collider other) { if (other.tag == "Ball") { Destroy(goBall); goBall = Instantiate(pfBall, spawnPoint.position, spawnPoint.rotation); } } }