- Home /
HELP 2D Game: Clone not picking up object (Crystals) HELP
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
We need to see your script along with details as to how your player and crystals are set up.
Crystal Script: http://pastebin.com/CuRRGXQk
The players script is just a standard 3D character controller with textures. Character $$anonymous$$otor: http://pastebin.com/3AVe1$$anonymous$$mt FPSInputController: http://pastebin.com/TdkDPSLZ
Answer by HarshadK · Oct 16, 2014 at 01:56 PM
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);
}
}