Im trying to change the camera position with this script but I am getting the error Assets/Scripts/ChangeView.cs(15,35): error CS0120: An object reference is required to access non-static member `UnityEngine.Transform.position'
I am new to unity and C#.
using UnityEngine;
using System.Collections;
public class ChangeView : MonoBehaviour {
private bool view;
private Transform trans;
void Start () {
view = true;
trans = GetComponent<Transform> ();
}
public void ChangeCamera () {
if (view == true) {
view = false;
Transform.position = new Vector3 (0.0f, 5f, -5f);
}
else {
view = true;
Transform.position = new Vector3 (0.0f, 1f, -1f);
}
}
}
Startwhich is like a constructor in Unity. - D Stanley