- Home /
Respawn Problem
I want a respawn script where when a player collide a object it will respawn its current position but i faced some problem here is my script using UnityEngine; using System.Collections;
public class Testrun : MonoBehaviour {
void OnTriggerEnter(Collider other)
{
transform.position = Vector3(1019.62f, 80.53411f, -801.2841f);
}
} and the problem is error CS0119: Expression denotes a type', where a
variable', value' or
method group' was expected i am new in scripting pls help me what i will do
Answer by bhartu · Sep 05, 2014 at 10:16 AM
add new keyword where you are creating Vector3.
like transform.position = new Vector3(1019.62f, 80.53411f, -801.2841f);
Answer by praveee · Sep 05, 2014 at 10:31 AM
you have missed the "NEW" :)
void OnTriggerEnter(Collider other)
{
transform.position =new Vector3(1019.62f, 80.53411f, -801.2841f);
}
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Could you help me with my respawn script c# 2d engine 0 Answers
Respawn Script 1 Answer
respawn at current position 0 Answers
Script errors. I'm Confused 1 Answer