Hey everyone, in my game when the player dies a clone is created at the spawn point which is all fine, but when the clone walks into the crystal the crystal doesn’t disappear (pick up) any ideas?
Thanks Dean
Hey everyone, in my game when the player dies a clone is created at the spawn point which is all fine, but when the clone walks into the crystal the crystal doesn’t disappear (pick up) any ideas?
Thanks Dean
Since you are checking the player using its name in your Crystal script and when you instantiate the object it will have a (clone) appended to it, Unity will not be able to find it.
You can provide your player game object “Player” tag and check in your crystal script using tag as below:
function OnTriggerEnter (info : Collider)
{
if (info.gameObject.tag == "Player")
{
GameMaster.currentScore += coinValue;
Destroy(gameObject);
audio.PlayOneShot(collectSound);
}
}