Hi guys. I’m switching to C# from Js and I’m trying to rewrite the JS example of Extanding the Editor. I keep getting a bunch of errors.
Here’s my code:
using UnityEngine;
using System.Collections;
public class LookAtPoint : MonoBehaviour {
public Vector3 lookAtPoint;
// Use this for initialization
void Start ()
{
lookAtPoint = Vector3.zero;
}
// Update is called once per frame
void Update ()
{
transform.LookAt(lookAtPoint);
}
}
and here’s the Editor code:
using UnityEditor;
using UnityEngine;
using System.Collections;
[CustomEditor(typeof(LookAtPoint))]
public class LookAtPointEditor : Editor
{
public override void OnInspectorGUI()
{
target.lookAtPoint = EditorGUILayout.Vector3Field("Look At Point", target.lookAtPoint);
if(GUI.changed)
{
EditorUtility.SetDirty(target);
}
}
}
I’m getting quite a few errors and I’m not sure where I am going wrong.
Thanks.
Kamil