Support => NGUI 3 Support => Topic started by: Legna on May 26, 2012, 05:03:20 AM
Title: Javascript interaction
Post by: Legna on May 26, 2012, 05:03:20 AM
Hello,
First, sorry for my ugly English. I'm French and really bad at grammar... OK word spelling also...
I tried to interact a javascript based project with NGUI. Searched for examples and tips but everything i found was not revelant enough for me to make it works.
I put all the folders in the plugin folder as intended, created a "test.js" file i put in a button object, then worked hard to get the "OnClick" information on this button or the change value of a slider.
I tried many ways, even by script reference :
#pragma strict
var _camera:UICamera;
function Onstart(){
_camera = Camera.main.GetComponent(UICamera);
}
function Update(){
//test = _camera.OnHover;
test = _camera.OnHover();
// .. and many other tries...
}
And it did not even worked.
I tried also with accessing the UICamera function like with iTween, but no success also.
Does anyone got a working solution because all my google/board search where unsuccessfully.
Thanks for your help and your time !
Best Regards,
Alexandre.
Title: Re: Javascript interaction
Post by: Legna on May 26, 2012, 05:35:39 AM
ok... tested in NGUI example and finally
function OnClick(){
print("click");
}
worked...
Now i have to find why it dont work in the tuto example i did... damn newbye of me...
Title: Re: Javascript interaction
Post by: ArenMook on May 26, 2012, 11:16:14 AM
Quote
function Onstart()
I think you mean Start, not Onstart.
Make sure "Raycast Hit Triggers" checkbox is checked in the physics properties and that your camera has UICamera attached.
Title: Re: Javascript interaction
Post by: Legna on May 26, 2012, 03:21:54 PM
Thanks for your answer. Yes i meant Start... too fast typing without thinking first...
I guess the mistake was coming effectively from the ray option.