Quantcast
Channel: Latest Questions by Hijackedbrain
Viewing all articles
Browse latest Browse all 14

How works the OnSceneGUI() method ?

$
0
0
Hello, I'm trying to develop a tool for the unity editor. To do so I need to detect when the user press a key/mouse button/whatever in the editor. So I thought about using the OnSceneGUI() method. It seems to fit my requirements. But I can't get it to work .... And the 3 lines manual page (http://docs.unity3d.com/ScriptReference/Editor.OnSceneGUI.html) doesn't help me very much on this. Here's what I got so far. using UnityEngine; using UnityEditor; using System.Collections; [CanEditMultipleObjects] [ExecuteInEditMode] public class localViewTool : Editor { void OnSceneGUI() { if (Event.current.type == EventType.MouseDown) { Debug.Log ("MouseButtonPressed"); Event.current.Use (); } } } But it doesn't do anything, and I don't understand why. Thanks for reading me, any help would be appreciated.

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>