So…i am having this script :
public class spawner : MonoBehaviour {
public GameObject obj;
public GameObject spObj;
public Transform spawnpoint;
private float repeatRate = 7.0f;
void Start()
{
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject== obj)
{
InvokeRepeating("Spawner", 0.5f, repeatRate);
Destroy(gameObject, 11);
gameObject.GetComponent<BoxCollider>().enabled
= false;
}
}
void Spawner()
{
Instantiate(spObj, spawnpoint.position, spawnpoint.rotation);
} }
But when i am making a clone of an object the object cloned doesnt have some references in the script like an audio source and some game object references …so it makes my object clone not acting like the original…,So i have an object that can be picked up and destroyed But when i make a clone of it with a script (on collider enter etc) the clone although it has the scripts attatched doesnt have some audio source and gae object references attatched to the script …and it makes the clone broken…what can i do?