- Home /
Teleportation script causing crash?
For some reason this script is causing my editor to crash. No idea why.
 using UnityEngine;
 using System.Collections;
 
 public class killerlocationboop : MonoBehaviour {
     public Vector3 newlocation=new Vector3();
     Vector3 startlocation;
     void Start(){
         startlocation = rigidbody.position;
     }
     // Update is called once per frame
     void Update () {
         if (0 <=Time.timeSinceLevelLoad % 10 && Time.timeSinceLevelLoad % 10 <= 4) {
             rigidbody.position = newlocation;
         } else {
             rigidbody.position = startlocation;
         }
     }
 }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Xarathorn · Jan 27, 2014 at 01:24 AM
Okay I figured it out. Just replace all the rigidbodys with transforms. 
Answer by gogott · Jan 27, 2014 at 01:24 AM
try:
 public Vector3 newlocation = Vector3.zero;
instead of:
 public Vector3 newlocation = new Vector3();
No, you're supposed to be able to enter the values you want. Vector3() allows you to do this in the editor window.
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Only Teleports Player Every Once in While 2 Answers
Making The Hole In A Golf Game 1 Answer
during build object moves different position than editor(vr) 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                