playMaker

Author Topic: [SOLVED]Playmaker and NGUI - Activate game object action is not working  (Read 6923 times)

bizilux

  • Full Member
  • ***
  • Posts: 171
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
« Last Edit: June 11, 2013, 03:30:35 PM by bizilux »

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Playmaker and NGUI - Activate game object action is not working
« Reply #1 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?

derkoi

  • Full Member
  • ***
  • Posts: 187
Re: Playmaker and NGUI - Activate game object action is not working
« Reply #2 on: June 11, 2013, 03:17:53 PM »
Create a button in NGUI

Add the UIEventsToPlaymakerFSM.cs script from here to the button

Instead of using Mouse Down use OnClick to move to your next state.
« Last Edit: June 11, 2013, 03:22:27 PM by derkoi »

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Playmaker and NGUI - Activate game object action is not working
« Reply #3 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!

derkoi

  • Full Member
  • ***
  • Posts: 187
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:

bizilux

  • Full Member
  • ***
  • Posts: 171
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?

derkoi

  • Full Member
  • ***
  • Posts: 187
Have you tried OnHover set up like OnPress?

bizilux

  • Full Member
  • ***
  • Posts: 171
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

derkoi

  • Full Member
  • ***
  • Posts: 187
No i meant use OnHover instead of OnPress  :)

bizilux

  • Full Member
  • ***
  • Posts: 171
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
« Last Edit: June 11, 2013, 08:24:03 PM by bizilux »