- Home /
Whats wrong with this script?
var yPosOffSet : float;//Offset y on load var savedTForm00 : Transform; var xcon00 : float;//convert the realtime pos var ycon00 : float; var zcon00 : float; private var xPos000 : String = "xPos000"; private var yPos000 : String = "yPos000"; private var zPos000 : String = "zPos000"; var xPos00 : float;//The var that will be saved. var yPos00 : float; var zPos00 : float;
function SaveIt00(){///==SAVEIT==/// PlayerPrefs.SetFloat(xPos000, xPos00); PlayerPrefs.SetFloat(yPos000, yPos00); PlayerPrefs.SetFloat(zPos000, zPos00); }
function LoadIt00(){///==LOADIT==/// xPos00 = PlayerPrefs.GetFloat(xPos000); yPos00 = PlayerPrefs.GetFloat(yPos000); zPos00 = PlayerPrefs.GetFloat(zPos000); savedTForm00.transform.position = Vector3(xPos00, yPos00 + yPosOffSet, zPos00); }
var autoLoad : boolean;
function Start() { if(autoLoad==true) { LoadIt00; } } function Update() { if(Input.GetKey("m")) { SaveIt00; } if((Input.GetKey("b"))&&(autoLoad==false)) { LoadIt00; } }
I keep getting these errors:
NewBehaviourScript12.js(33,3):BCE0034:Expressions in statements must only be executed for their side-effects
NewBehaviourScript12.js(38,3):BCE0034:Expressions in statements must only be executed for their side-effects
NewBehaviourScript12.js(41,3):BCE0034:Expressions in statements must only be executed for their side-effects
Can you please tell me whats wrong? Thanks Smile
(I did not write this script myself)
It is good to give meaningful and specific title and tags...
Answer by Mike 3 · Jul 31, 2010 at 07:21 PM
You're missing the () after each use of the function - Once in Start, twice in Update.
Need to use LoadIt00(); and SaveIt00(); and you're sorted
Your answer
Follow this Question
Related Questions
Application.Quit 2 Answers
"Expressions in statements must only be executed for their side effects." ERROR. 3 Answers
Expressions in statements must only be executed for their side effects 1 Answer
Error: Expression denotes a `X', where a `Y' was expected 1 Answer
Whats wrong with my C-Sharp Script? 1 Answer