Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class changeScenes : MonoBehaviour
- {
- public static int iterator = 0;
- // Start is called before the first frame update
- void Start()
- {
- Load();
- iterator++;
- }
- public void Load()
- {
- if (iterator!=0)
- {
- transform.position = new Vector3(PlayerPrefs.GetFloat("x"), PlayerPrefs.GetFloat("y"), PlayerPrefs.GetFloat("z"));
- transform.rotation = Quaternion.Euler(PlayerPrefs.GetFloat("rotx"),PlayerPrefs.GetFloat("roty"),PlayerPrefs.GetFloat("rotz"));
- }
- transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z);
- }
- public void Save()
- {
- PlayerPrefs.SetFloat("x", transform.position.x);
- PlayerPrefs.SetFloat("y", transform.position.y);
- PlayerPrefs.SetFloat("z", transform.position.z);
- PlayerPrefs.SetFloat("rotx", transform.rotation.eulerAngles.x);
- PlayerPrefs.SetFloat("roty", transform.rotation.eulerAngles.y);
- PlayerPrefs.SetFloat("rotz", transform.rotation.eulerAngles.z);
- }
- // Update is called once per frame
- void Update()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement