The green balls search out for white ones and "infect" them. The white balls are destroyed but they come back at the point of origin. I've tried to make a variable of the position of the white balls but I keep running into "Can't convert Transform to Vector3" errors.
public Rigidbody prefabInfection;
public Transform infectLocation;
void OnCollisionEnter(Collision colInfo)
{
if (colInfo.collider.tag == "Infection")
{
Destroy(gameObject);
Instantiate(prefabInfection);
}
}
That's the code that's currently being used on collision.
I'm new to Unity also. Should I not destroy the white balls and instead somehow turn them into green balls? Is that possible?
Instantiation seemed like the only way. All I want to do is replace the white "human" balls to green "infection" ones.