- Home /
Question by
Nachulu · Feb 25, 2014 at 05:39 AM ·
javascript
[HELP] BCE0022: Cannot convert 'UnityEngine.Vector3' to 'UnityEngine.GameObject'.
var VidaPj : int = 100;
static var VidaTotal : int = 100;
var danvida : int = 2.5;
var posicionInicial : Vector3;
var posicionRespawn : GameObject;
function Start () {
posicionInicial = Vector3 (-24,2,0);
}
function OnControllerColliderHit (hit : ControllerColliderHit) {
if(hit.gameObject.tag == "Brazos"){
VidaPj -= danvida;
}
}
if (VidaPj <= 0){
posicionRespawn = transform.position;
VidaPj = VidaTotal;
}
Help. I receive this error and nose to do. My english is bad.
I hope your answers and thanks :)
Comment
Best Answer
Answer by robertbu · Feb 25, 2014 at 05:42 AM
The issue is on line 24. You are assigning a Vector3 to a GameObject just like the error message indicates. I don't have context for what you want to do here. Perhaps you wanted:
posicionRespawn.transform.position = transform.position;
Or maybe you wanted:
posicionInicial = transform.position;
THAN$$anonymous$$SSSSSSSSSSS! the first option is what I need. :)