Comments and answers for "Unity 4.6 beta button with Javascript rather than C#"http://answers.unity.com/questions/792828/unity-46-beta-button-with-javascript-rather-than-c.html
The latest comments and answers for the question "Unity 4.6 beta button with Javascript rather than C#"Comment by HarshadK on HarshadK's answerhttp://answers.unity.com/comments/793164/view.html
He initially worked on that but later he left and since then Unity GUI has deviated from NGUI a lot.
To quote Aron Mook (NGUI guy) from his forum itself ([New Unity GUI and NGUI][1]):
> I left Unity back at the end of
> November last year after working there
> for 13 months. NGUI and uGUI are
> completely different systems now and I
> can't comment much on uGUI beyond what
> was said in the past. I'll leave the
> talking to those who are actively
> developing it (and there are quire a
> few very talented guys on it).
>
> I am focusing on NGUI because it's
> also what I am using myself in my own
> projects (currently Windward). The
> development / fixes / polish happen
> naturally.
[1]: http://www.tasharen.com/forum/index.php?topic=8666.0Thu, 18 Sep 2014 14:16:01 GMTHarshadKComment by Anxo on Anxo's answerhttp://answers.unity.com/comments/793157/view.html
Its not? I thought the they hired the guys who made NGUI to make the new GUI system. It even looks very similar in the videos.Thu, 18 Sep 2014 14:04:43 GMTAnxoComment by Eric5h5 on Eric5h5's answerhttp://answers.unity.com/comments/792858/view.html
It's not based on NGUI.Thu, 18 Sep 2014 02:29:08 GMTEric5h5Answer by orbhttp://answers.unity.com/answers/792842/view.html
Well, you can do it the same way as in C#:
#pragma strict
import UnityEngine.EventSystems;
class Filth extends MonoBehaviour implements IPointerEnterHandler
{
function OnPointerEnter(data : PointerEventData)
{
Debug.Log(data.position.x+", "+data.position.y);
}
}
You can implement any of the events like that. You just need to explicitly declare a class and not lazily just fill a file with methods. But now you're getting close to the verbosity of C# and still not getting faster compile times or namespaces ;)Thu, 18 Sep 2014 01:40:58 GMTorbComment by matta9001 on matta9001's answerhttp://answers.unity.com/comments/792840/view.html
I am sure the developers of unity have sort of implemented something so that us javascript coders can actually make use of the new features. I see what you are saying in the script you wrote, but this might be too much work for something that might be pretty simpleThu, 18 Sep 2014 01:39:13 GMTmatta9001Answer by Anxohttp://answers.unity.com/answers/792836/view.html
I have not messed with the new Beta but I know the new GUI is based on the NGUI which I do use and its buttons trigger a public void method inside of a class.. (a function inside of a script). If you wish to continue using Javascript while using these buttons you could write a small C# script that just sends button calls along but it would be very inconvenient. Something like this.
// All scripts in C# and this stuff.
using UnityEngin;
using System.Collection;
public Class ButtonExtention : Monobehaviour {
/// Here is where the actual script is. where all the content goes.
public GameObject JavascriptButtonReciver;
public void ButtonA{
// Button A was pressed, Send it to the javascript
JavascriptButtonReciver.BroadcastMessage("ButtonA");
}
public void ButtonB{
// Button B was pressed.
JavascriptButtonReciver.BroadcastMessage("ButtonB");
}
}
This would allow you to make as many public voids receivers as you want and then have the message relayed to your javascript as "BraodcastMessage" works the same in Javascript as it does in C# so you can broadcast messages from one to the other.
Forgive the errors as I am not near Unity to test the code. But you get the idea.Thu, 18 Sep 2014 01:20:18 GMTAnxo