hi, i have a problem with assigning arrays with for in loops. I’m going to make PlayerPrefsX.SetVector3Array with this. How to make it saves / assign the Arrays of Vector3 in RegSaver Vector3 arrays (which saves the arrays) ? But, when i’m trying to make the for(var om in rs.objPos) transform.position = om; and yea it’s really does working but when i check the RegSaver arrays, all values of Vector3 were same. You know what i mean right ? Please. thanks for the read
this is my script. (objects.js) rs is RegSaver;
if(PlayerPrefs.HasKey("plx")){
positions = PlayerPrefsX.GetVector3Array("plx");
for(var om in rs.objPos){
transform.position = om;
}
}
function Update () {
if(Input.GetKeyDown("b")) SaveExitGame();
for(var om in rs.objPos){
om = transform.position;
}
}
and RegSaver.js
var objPos : Vector3[];
var usedObj : boolean[];
function Update(){
if(Input.GetKeyDown("p")){
SaveThisPrg();
}
}
function LoadThisPrg(){
objPos = PlayerPrefsX.GetVector3Array("plx");
usedObj = PlayerPrefsX.GetBoolArray("pbx");
}
function SaveThisPrg () {
PlayerPrefsX.SetVector3Array("plx",objPos);
}