Search Unity

Editor GUI Send Message Interface

Discussion in 'Immediate Mode GUI (IMGUI)' started by LaireonGames, Mar 3, 2015.

  1. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Hey everyone,

    Been searching around for a bit and can't seem to find the answer. I know how to do this manually but I feel like Unity will have exposed something to make this easier and would rather use that if possible. Basically what I would like to recreate in a custom editor script is this (Image below)

    Just incase that image doesn't load/to be clear what I am trying to do is show the new standard send message interface that lets you drop a gameobject and then select the method to run from it.

    Cheers!
    Jason
     

    Attached Files:

  2. billykater

    billykater

    Joined:
    Mar 12, 2011
    Posts:
    329
    Take a look at http://docs.unity3d.com/ScriptReference/Events.UnityEvent.html which is the underlying type of such events. It should provide all things needed(with the default gui). If you just want to recreate a similar thing you should be able to look at the source code for it in the unity ui source code.
     
  3. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Your answer didn't really make any sense at first but after a bit of experimenting I can see your right and it works :D

    Basically, for anyone else reading this, you need to do something like this:

    Code (CSharp):
    1.  public UnityEvent eventName;
    Then you will see the event exposed as I was wanting. Not tested this yet but assume once you are ready you can call Invoke to run the event/s