Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Accessing OnSceneGUI with EditorWindow in JS

Discussion in 'Scripting' started by winner1324, Sep 23, 2014.

  1. winner1324

    winner1324

    Joined:
    Sep 5, 2012
    Posts:
    5
    I have been trying now to access OnSceneGUI() while using EditorWindow and nothing seems to be working. Everything I have looked at is in C# and converting it to JS just yields errors. I have tried SceneView.onSceneGUIDelegate += OnSceneGUI(); but it just give me the following error: Operator '+' cannot be used with left hand side of type 'function(UnityEditor.SceneView): void' and right hand side of type 'void'.

    At this point I am willing to try anything. I really need it to be in JS. If I really need to I will convert to C#, but that is a last resort. Thanks in advance!
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    Why, theres little or no advantage to using js over c#, and some disadvantages.

    Anyway :
    http://unity3d.com/learn/tutorials/modules/intermediate/scripting/delegates
    Maybe you can wrap "OnSceneGUI();" into a variable, and add that, I can't test for myself atm
     
  3. winner1324

    winner1324

    Joined:
    Sep 5, 2012
    Posts:
    5
    Thanks for the reply. I know very little C# and I do not have time right now to learn it. Its on my list of things to learn. As for wrapping OnSceneGUI() in a variable is something I did not think of. Will report back in a few minutes.
     
  4. winner1324

    winner1324

    Joined:
    Sep 5, 2012
    Posts:
    5