Accessing Component from an Editor Script

I have a folder in assets called scripts, within that folder, I have the below class

public class Waypoint : MonoBehaviour {

public Waypoint[] waypoints;

public enum WaypointType { Link, Planet, Rotation };

public WaypointType type = Waypoint.WaypointType.Link;

public Planet planet;

// Use this for initialization
void Start () {

I have attached this to a few gameobjects in a scene.

I’m would like to create an editor to edit the parameters of the Waypoint component on each gameobject.

Whenever I create an editor script ,and put the script in to the editor folder, I cant access the type of Waypoint.

So my question is: How do I modify the properties of this component on a gameobject, using an editor script? How can I access this component if the editor isn’t aware of the type?

I would check that your custom inspector is being shown for your component type. See the Unity help here:

In C# you would subclass Editor as follows:

public class WaypointEditor : Editor
   public override void OnInspectorGui()
   {   // you may wish to call the base if you're just adding to it?

That said, your question is a bit confusing - if you click on the GameObject you will see the public fields you can edit in the inspector anyway, the above just allows you to create something a bit more user friendly. Indeed you may wish to create an EditorWindow (see link above again).

You can also consider creating a gizmo or drawing extra detail in OnSceneGUI(), maybe add some handles if that makes sense:

I have same problem with javascript.
Please help me to get out of this.