Hi! Thanks in advance!I get the errors for the code below
ERR 1:Assets/Scripts/PositionLoader.cs(8,27): error CS1612: Cannot modify a value type return value of UnityEngine.Transform.position'. Consider storing the value in a temporary variable
ERR 2:Assets/Scripts/PositionLoader.cs(9,27): error CS1612: Cannot modify a value type return value of UnityEngine.Transform.position'. Consider storing the value in a temporary variable
ERR 3:Assets/Scripts/PositionLoader.cs(10,27): error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.position'. Consider storing the value in a temporary variable
Code: using UnityEngine;
using System.Collections;
public class PositionLoader : MonoBehaviour {
// Use this for initialization
void Start () {
transform.position.x = PlayerPrefs.GetFloat("PositionX");
transform.position.y = PlayerPrefs.GetFloat("PositionY");
transform.position.z = PlayerPrefs.GetFloat("PositionZ");
}
// Update is called once per frame
void Update () {
PlayerPrefs.SetFloat ("PositionX", transform.position.x);
PlayerPrefs.SetFloat ("PositionY", transform.position.y);
PlayerPrefs.SetFloat ("PositionZ", transform.position.z);
}
}
Written in C# Thanks Again!
Please No Abusive Mods who delete everything! :D
↧