- Home /
Script Not Accepting Values from Editor
I'm using the "move" script that was posted back in November (seen below) but when I edit the Point B values in the editor, the object still just moves to 0,0,0 in game instead of what values I assigned for Point B. Any help would be greatly appreciated.
var pointB : Vector3;
function Start () { var pointA = transform.position; while (true) { yield MoveObject(transform, pointA, pointB, 3.0); yield MoveObject(transform, pointB, pointA, 3.0); } }
function MoveObject (thisTransform : Transform, startPos : Vector3, endPos : Vector3, time : float) { var i = 0.0; var rate = 1.0/time; while (i < 1.0) { i += Time.deltaTime * rate; thisTransform.position = Vector3.Lerp(startPos, endPos, i); yield; } }
Answer by kennypu · Apr 11, 2011 at 08:23 PM
are you changing the values while in play mode? if so, the changes will revert back, thus not saving. make sure you're not in play mode, and then edit the value, and then run the game.
Just double checked, not in play mode. I am so perplexed by this. This is my first script ever in Unity and I'm not sure what I'm doing wrong. Obviously the script is activating because the object is moving. It's just moving to the wrong place.
what are you putting in for pointB? it might be easier if you put a placement object at the position you want it to go, and then drag that object into the pointB parameter in inspector.
So how I fixed this was to just change the var : Vector3 to var = Vector3 and the values were just pointA.x, 30, and pointA.z.
Had to take it out of the editor and do it in scripting. Finally worked.
Thanks for he help though! Upboats for you. :-D
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
c# script not doing anything. 2 Answers
Sprint Script Error?!!!! 4 Answers
visible lights 0 Answers
Moving GameObjects with Mouse 1 Answer