I’ve manage to write up enough to allow me to save the gameobjects activity (if the gameobjects are active)
but i’m having some trouble with the PlayerPrefsX.SetVector3Array and PlayerPrefsX.SetQuaternionArray.
It’s hard to find any sort of information I personally can get help from so I’m seeking help here.
Here is where I got my information and the PlayerPrefsX.cs
http://wiki.unity3d.com/index.php/ArrayPrefs2
and here is my script.
any help would be great.
using UnityEngine;
using System.Collections;
public class S_GameObject : MonoBehaviour {
[Header("SaveName")]
//save gameObject isActive?
public string objACT;
//save gameObject position & rotation
public string objPOS;
public string objROT;
[Space(10)]
[Header("TRAPS")]
//objects to save
public GameObject[] traps;
[Space(10)]
[Header("ACTIVITY")]
// bool for isActive
public int[] onOFF;
public void SaveIt()
{
//Save Activity
PlayerPrefsX.SetIntArray(objACT, onOFF);
//Save Pos/Rot
PlayerPrefsX.SetVector3Array(objPOS, traps[]);
PlayerPrefsX.SetQuaternionArray(objROT, traps[]);
}
public void LoadIt()
{
onOFF = PlayerPrefsX.GetIntArray(objACT);
}
// Update is called once per frame
void Update () {
//SAW
if(onOFF[0] == 1)
{
traps[0].SetActive(true);
}
if (onOFF[0] == 0)
{
traps[0].SetActive(false);
}
//SAW1
if (onOFF[1] == 1)
{
traps[1].SetActive(true);
}
if (onOFF[1] == 0)
{
traps[1].SetActive(false);
}
//SAW2
if (onOFF[2] == 1)
{
traps[2].SetActive(true);
}
if (onOFF[2] == 0)
{
traps[2].SetActive(false);
}
//SAW3
if (onOFF[3] == 1)
{
traps[3].SetActive(true);
}
if (onOFF[3] == 0)
{
traps[3].SetActive(false);
}
//SAW4
if (onOFF[4] == 1)
{
traps[4].SetActive(true);
}
if (onOFF[4] == 0)
{
traps[4].SetActive(false);
}
//SAW5
if (onOFF[5] == 1)
{
traps[5].SetActive(true);
}
if (onOFF[5] == 0)
{
traps[5].SetActive(false);
}
//SAW6
if (onOFF[6] == 1)
{
traps[6].SetActive(true);
}
if (onOFF[6] == 0)
{
traps[6].SetActive(false);
}
//SAW7
if (onOFF[7] == 1)
{
traps[7].SetActive(true);
}
if (onOFF[7] == 0)
{
traps[7].SetActive(false);
}
//SAW8
if (onOFF[8] == 1)
{
traps[8].SetActive(true);
}
if (onOFF[8] == 0)
{
traps[8].SetActive(false);
}
//SAW9
if (onOFF[9] == 1)
{
traps[9].SetActive(true);
}
if (onOFF[9] == 0)
{
traps[9].SetActive(false);
}
}
}