Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: bizilux on June 11, 2013, 10:16:37 AM

Title: [SOLVED]Playmaker and NGUI - Activate game object action is not working
Post by: bizilux on June 11, 2013, 10:16:37 AM
hey all

just started using ngui and playmaker...

i was following this tutorial
 this guy creates buttons, and then uses activate game object action to enable and disable quest log and character window...
but i cant do the same... i do everything 100% the same, but just wont work...

so now i made new scene and wanted to make simplistic version, still wont work
(see attachment)

first state is "clicked" state, where i use system even transition, MOUSE DOWN
then second state is "open window" where i use activate game object, to deactivate background window.
but it wont deactivate it...


if i use a bit of debugging: playmaker just wont register the click and go on "open window" state...
even if i use MOUSE OVER transition, it still wont register it
Title: Re: Playmaker and NGUI - Activate game object action is not working
Post by: bizilux on June 11, 2013, 02:13:12 PM
i did the same thing, with 2 cubes, same FSM as before...

the cube deactivates and appears back just fine...BUT it just doesnt work with objects created with NGUI

whats wrong?
Title: Re: Playmaker and NGUI - Activate game object action is not working
Post by: derkoi on June 11, 2013, 03:17:53 PM
Create a button in NGUI

Add the UIEventsToPlaymakerFSM.cs script from here (http://hutonggames.com/playmakerforum/index.php?topic=1356.0) to the button

Instead of using Mouse Down use OnClick to move to your next state.
Title: Re: Playmaker and NGUI - Activate game object action is not working
Post by: bizilux on June 11, 2013, 03:30:09 PM
THANK YOU alot!

i did put this script on the button: https://hutonggames.fogbugz.com/default.asp?W1111  (more recent version)

but i just didnt know the last step, of replacing mouse down, with OnClick... or in my case, with NGUI / ON CLICK

thanks!
Title: Re: [SOLVED]Playmaker and NGUI - Activate game object action is not working
Post by: derkoi on June 11, 2013, 03:37:48 PM
No problem, glad you got it working.

Here's another tip as it took me a little while to figure out. if you want a button to keep activating something when it's help down like a car accelerator use OnPress but like this:
Title: Re: [SOLVED]Playmaker and NGUI - Activate game object action is not working
Post by: bizilux on June 11, 2013, 04:29:46 PM
thanks for that, im currently not doing that, but i guess i will need it further on :)

what im working on is radial menu, and i cant seem to find MOUSE EXIT function

because when i hover over buttons inside radial menu, i want them to display another set of buttons next to it, that works just fine, but now i cant deactivate those buttons again when mouse leaves the button... because theres no MOUSE EXIT function... :S

i tested this with cubes and it works, i just cant do it in NGUI :S

do you know how to write code for MOUSE EXIT and add it to that .cs script?
Title: Re: [SOLVED]Playmaker and NGUI - Activate game object action is not working
Post by: derkoi on June 11, 2013, 04:45:06 PM
Have you tried OnHover set up like OnPress?
Title: Re: [SOLVED]Playmaker and NGUI - Activate game object action is not working
Post by: bizilux on June 11, 2013, 04:56:15 PM
well OnPress is not exactly what im looking for, since you need to press the button, i need hover over it...

see attachment, thats how i have it right now for OnPress, it works, but now how i want it... it works when its pressed, not when its hovered
Title: Re: [SOLVED]Playmaker and NGUI - Activate game object action is not working
Post by: derkoi on June 11, 2013, 05:05:02 PM
No i meant use OnHover instead of OnPress  :)
Title: Re: [SOLVED]Playmaker and NGUI - Activate game object action is not working
Post by: bizilux on June 11, 2013, 05:23:06 PM
hah ur the man :)

i had OnHover setup before, but wrong way i guess... but now i did it again and it works :)

i feel a bit dumb, but oh well, i started using NGUI and playmaker yesterday :)


check my other thread "How to position GameObject at mouse cursor when mouse button is clicked?"  if you want to help some more :) hehe

i will be making video tutorial on youtube at the end of this for everyone that will be interested in it