User Interface Event decoupler
EventBinder asset for Unity
The Unity-EventBinder plugin is a de-coupling event framework built to specifically to target Unity 3D. It can be used to separate the event triggers (ex: Button "onClick") from the event listeners.
This project is open source. You can find the officical repository here
For general troubleshooting / support, please post to stack overflow using the tag 'UnityEventBinder'.
Or, if you have found a bug, you are also welcome to create an issue on the github page, or a pull request if you have a fix / extension.
You can install Unity-EventBinder using the following method:
From Github Page. Here you can choose between the following:
There are 3 main components for the EventBinder plugin
The EventsCollection class
public static event Action<string> EventWithStringArgument = delegate (string stringArgument) {};
The EventBinderBehaviour class
public class EventBinderSampleListenerController : MonoBehaviour
{
/**LIFECYCLE*/
private void Start ()
{
AddListeners();
AddListenersStatic();
}
/**EVENT REGISTRATION*/
private void AddListeners()
{
EventsCollection.eventWithStringArgs += OnEventWithStringArgsHandler;
}
private static void AddListenersStatic()
{
EventsCollection.eventWithStringArgs += OnStaticEventWithStringArgsHandler;
}
/**EVENT HANDLERS*/
public void OnEventWithStringArgsHandler(string value)
{
Debug.Log ("We got a new message with a String parameter: " + value);
}
public void OnStaticEventWithStringArgsHandler(string value)
{
Debug.Log ("[STATIC] We got a new message with a String parameter: " + value);
}
}
The MIT License (MIT)
Copyright (c) 2018 George Dascalu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.