Log in or register to post comments

Virtual Buttons using Unity JS

March 17, 2012 - 9:04am #1

How do you implement Virtual Buttons using Unity JS?

How do you extend IVirtualButtonEventHandler to be able to use the methods OnButtonPressed and OnButtonReleased?

Re: Virtual Buttons using Unity JS

March 18, 2012 - 6:25pm #2

You can't implement a C# interface in JS directly. The best you can do is implement it in C# and call to JS functions. Use the VirtualButtons sample as a starting point, the Scripts/VirtualButtonEventHandler.cs script in particular.

If you do call to JS functions you'll need to place your JS classes in the Plugins folder (or some folder that Unity compiles in an earlier phase). See this guide for more details: http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html

- Kim

Log in or register to post comments