- Home /
Editor Script no longer working after importing to second project
Hello. I have made an editor script that allows users to click in the scene view and draw lines. It was working perfectly in one project, although I've since tried to incorporate it with a second project, and it has stopped working. Below is the bare bones of the script. I'd be grateful if anyone has any ideas/suggestions.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class EditorClass : Editor {
void OnEnable() {
SceneView.onSceneGUIDelegate += SceneGUI;
}
void SceneGUI(SceneView sceneView) {
SceneView.RepaintAll();
if (Event.current.type == EventType.layout)
HandleUtility.AddDefaultControl(GUIUtility.GetControlID(GetHashCode(), FocusType.Passive));
if (Event.current.type == EventType.mouseDown) {
//Do stuff...
}
else if (Event.current.type == EventType.keyDown)
//Do stuff
else if (Event.current.type == EventType.mouseMove)
//Do stuff
}
}
Answer by KevLoughrey · Jun 06, 2014 at 02:55 PM
Fixed it by changing it to an EditorWindow script and making it toggleable via the Window dropdown. Still not sure why it worked in one project and not the other.
Your answer
Follow this Question
Related Questions
Setting up a key to cycle through editor modes 0 Answers
Set prefab to public variable of another script 1 Answer
Is it possible to detect changes to a different component within an editor script? 0 Answers
Editor Scripting: Is there a "Timeline" class? 0 Answers
Create mesh by defining points 3 Answers