Created
December 18, 2012 10:17
-
-
Save gashtio/4326870 to your computer and use it in GitHub Desktop.
Binding JavaScript manually in Unity3D using Coherent UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ManualBinding : MonoBehaviour { | |
private CoherentUIView m_View; | |
// Use this for initialization | |
void Start () { | |
m_View = GetComponent<CoherentUIView>(); | |
m_View.Listener.ReadyForBindings += HandleReadyForBindings; | |
} | |
void HandleReadyForBindings (int frameId, string path, bool isMainFrame) { | |
if (isMainFrame) { | |
// bind ApplyOptions to "ApplyOptions" in JavaScript | |
m_View.View.BindCall("ApplyOptions", (Action<GameOptions>)this.ApplyOptions); | |
} | |
} | |
public void ApplyOptions(GameOptions options) { | |
// Do something with options | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment