- Home /
(FIXED)This respawn code won't work!
I don't know how to fix this code but it won't work, no matter how I try to fix it and I get an error saying this:
Assets/SSTW/respawn.js(6,9): BCE0019: 'GameObject' is not a member of 'function(UnityEngine.Object, float): void'.
The code:
#pragma strict
var Player : GameObject;
var spawnPoint : Transform;
function OnTriggerEnter(other : Collider){
Destroy.GameObject;
var P : GameObject = Instantiate(Player, spawnPoint.position, Quaternion.identity);
var sf = Camera.main.GetComponent(SmoothFollow2D);
sf.target = P.transform;
}
I need help ASAP!!! I found a better way how to do it.
Comment
Answer by YoungDeveloper · Nov 29, 2014 at 01:10 PM
Destroy.GameObject;
Destroy is a method, two param overloads are possible.
Destroy(gameObject); //Will destroy instantly
Destroy(gameObject, 5f); //Will destroy after 5 seconds
I need the working code due to I am using the code in a different way. Check out this link:
http://forum.unity3d.com/threads/new-2d-platformer-spoiler-alert.282988/
EDIT: never $$anonymous$$d I am now using the restart level method
Your answer
Follow this Question
Related Questions
Error in the script 0 Answers
CharacterController.isGrounded script error 0 Answers
Damage the Player 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers