playMaker

Author Topic: activate gameobject - why so complicated?  (Read 369 times)

Fitbie

  • Playmaker Newbie
  • *
  • Posts: 31
activate gameobject - why so complicated?
« on: January 28, 2023, 11:16:37 PM »
Hi! I've been using the PlayMaker Activate GameObject action for quite some time and often. Usually it doesn't cause any problems, but a couple of times I've run into some inconvenience. Once again, I need to activate an object that's in a deep hierarchy and has many child objects. And when I use action Activate GameObject - it just turns on all the children (Recursive only affects whether the children will be turned on when reactivated)
At the same time, a simple "set property - active" has no such problems
After opening the script ActivateGameobject I found a huge and long code, although I expected something at the level of GameObject.SetActive etc.

Why is it so complicated? Maybe I do not understand the pitfalls?
Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: activate gameobject - why so complicated?
« Reply #1 on: January 29, 2023, 01:48:13 AM »
Hi.

if you look to the code you can see several #if UNITY_X_X
these are there to be compatible with other unity versions
when build, the versions that are not your unity version will not be added in your build.
Also when playing in editor, that code will not be used.

to place the object  inside the activate game, you only have to click the 'use owner' and set to specify game object, then drag in the object.
OR
Drag and drop the gameobject into the action window, then select GameObject/GameObject/ActivateGameObject

Set property is using mirroring and is slow (as it has to go thru all code on a object)
also on mobile/consoles you will need to use Linker wizard else the code method parts used by propertied might not be included and break your game.