The namespace ''..." already contains a definition for

Viewed 56

Here is my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
 
public class NodeEditor : EditorWindow
{
   [MenuItem("Editors/Node Editor")]
   private static void Init ()
   {
       EditorWindow w = EditorWindow.GetWindow(typeof(NodeEditor), true,"Node Editor");
       w.Show ();
   }    
 
   private void OnGUI ()
   {
       SetupHeader ();
       NodeLoop ();
       Repaint ();
   }
 
    private void SetupHeader ()
    {
        Rect header = r (0, 0, width, 90);
        GUI.Box (header, "");
 
        Rect placeNode = o (header, 20, 5, 100, 20);
        if (GUI.Button(placeNode, "Place Node"));
        {
 
        }
    }
 
   private void NodeLoop()
   {
 
   }
 
    private float width
    {
        get
        {
            return Screen.width;
        }
    }
 
    private float height
    {
        get
        {
            return Screen.height;
        }
    }
 
    private Rect r (float xPos, float yPos, float xSize, float ySize)
    {
        return new Rect (new Vector2(xPos,yPos), new Vector2(xSize,ySize));
    }
 
    private Rect o (Rect r,float xOff, float yOff, float xSize, float ySize)
    {
        return new Rect (new Vector2(r.position.x + xOff, r.position.y + yOff), new Vector2(xSize,ySize));
    }




}

and here are my errors,

Assets\Node Editor\Editor\NodeEditor.cs(6,14): error CS0101: The namespace '' already contains a definition for 'NodeEditor' Assets\Node Editor\Editor\NodeEditor.cs(9,24): error CS0111: Type 'NodeEditor' already defines a member called 'Init' with the same parameter types Assets\Node Editor\Editor\NodeEditor.cs(15,17): error CS0111: Type 'NodeEditor' already defines a member called 'OnGUI' with the same parameter types

1 Answers

Wrap the class in a namespace. Namespaces are basically containers for classes

Related