// Start is called before the first frame update void Start() { profile = null; startLocalPos = transform.localPosition; startRot = transform.localRotation; parent = transform.parent; if (Application.platform == RuntimePlatform.Android) { _filesPath = Application.persistentDataPath; } else { _filesPath = Application.streamingAssetsPath; } OpenJsonProfile(); }
public void OpenJsonProfile() { string _fileName = profileName; Debug.Log(File.Exists(_filesPath + "/" + _fileName + ".json")); if (File.Exists(_filesPath + "/" + _fileName + ".json")) { string _t = File.ReadAllText(_filesPath + "/" + _fileName + ".json"); profile = JsonUtility.FromJson <ItemInteractiveProfie>(_t); Debug.Log(_filesPath + "/" + _fileName + ".json \n" + _t); profileLoaded = true; } else { Debug.Log("DONT FIND: " + _filesPath + "/" + _fileName + ".json \n"); } }
public void SetGrabPose(string name) { transform.SetParent(lastHand._handRoot); JsonSign grabSignFile = new JsonSign(); grabSignFile._name = name; lastHand.SetJsonGoalsFromCurrentHand(grabSignFile); profile = new ItemInteractiveProfie(); profileName = name; profile.localPos = transform.localPosition; profile.localRot = transform.localRotation; profile.sign = grabSignFile; transform.SetParent(parent); transform.localPosition = startLocalPos; transform.localRotation = startRot; string _json = JsonUtility.ToJson(profile); Debug.Log(_json); File.WriteAllText(_filesPath + "/" + gameObject.name + ".json", _json); }