playMaker

Author Topic: deactivate the parent alone  (Read 6980 times)

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
deactivate the parent alone
« on: December 06, 2012, 09:03:21 AM »
Hi
since unity 4 all my action with activate game object and set to recursive doesn't work
but it still in the action browser . do you plan on removing it ?
so my problem is how to activate/deactivate game objects ? with children or without children
thank you

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: deactivate the parent alone
« Reply #1 on: December 06, 2012, 10:06:06 AM »
That's because of the change Unity made to SetActive() function. Whilst in previous versions you could activate/deactivate a single object, now with SetActive() you toggle an object and, recursively, all of its children. If you want to have an object active and the children deactivated, disable only the children.
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: deactivate the parent alone
« Reply #2 on: December 06, 2012, 10:55:26 AM »
thank you
i have read the change log of unity 4
however i need to deactivate the parent alone and leave the children active ( so the FSM on the children dosn't get deactivated )

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: deactivate the parent alone
« Reply #3 on: December 06, 2012, 11:42:51 AM »
Then you should have parented those children in an invisible parent, detach that parent from the one you want to disable, and disable that parent, meaning that your children are no longer from that object.
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: deactivate the parent alone
« Reply #4 on: December 07, 2012, 04:40:53 AM »
will that is impossible :(
we are talking about NGUI panel as the perent and the elements as the children.
playmaker should adapt to the new changes.

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: deactivate the parent alone
« Reply #5 on: December 07, 2012, 08:58:32 AM »
But that is not a problem of Playmaker, but a change made by Unity itself.

Since it had to track all the hierarchy to have a child active while the parent disabled, they somehow decided to only deactivate the parent and, recursively, disabling its children. Moreover, why do you want a panel disabled and its contents active? Has the panel any other scripts executing even while dismissed? Have you tried turning off those components instead?
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: deactivate the parent alone
« Reply #6 on: December 07, 2012, 09:12:15 AM »
im parenting game object (inventory item) to a button and i got FSM on the game object.
so right now the object get disabled and the FSM stop.

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: deactivate the parent alone
« Reply #7 on: December 07, 2012, 05:56:39 PM »
Yes, because you disable the panel, which is the parent.
Now, my question is, precisely, in which scenario would you need an inventory object active, and its container inactive?
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: deactivate the parent alone
« Reply #8 on: December 08, 2012, 03:15:09 AM »
i need it active to send global event when the object is picked up to alert other object in the scene :)
after that it will be active only when the panel is active.

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: deactivate the parent alone
« Reply #9 on: December 09, 2012, 03:54:50 AM »
any solution or workaround ?

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: deactivate the parent alone
« Reply #10 on: December 09, 2012, 12:01:56 PM »
i have found a workaround a good one too :)
ps: i still think playmaker need to remove or at least comment on recursive actions.

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: deactivate the parent alone
« Reply #11 on: December 10, 2012, 09:32:46 AM »
Would you like to share that workaround?

I do understand why Unity changed the way the objects are deactivated, but, having used the previous way, it's more than annoying to have to do a lot of things to have a single object in a lower level of the hierarchy activated.

But, for the scenario you mention, is like you have the object outside of your panel (let's say, like a pickup in your world?), then, if you pick up it, it'll send an event to a manager, I think, so it'll be added to your panel. So, if my assumption is correct, your panel does not need an FSM, and it's not a problem if you have all its hierarchy disabled in a given moment. Just have your manager listening to those events your items send. Perhaps you have this issue because you initialize your pickups being parented with the panel, but somehow, you only relate them after being picked up?

Remember that Playmaker does not implement what it does, but it calls Unity functions. So, if you want Playmaker to be no longer recursive in toggling GameObjects, you might have to check if Unity has a way to do so from Unity 4.
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8