Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Wrensey on December 10, 2019, 06:45:16 PM
-
is there a way to use the "Set Property" action on a variable gameObject?
I found this old thread but I didn't understand what Kiriri was saying: https://hutonggames.com/playmakerforum/index.php?topic=2791.0
What I am basically trying to do is turn off the collider of a gameObject when the player picks it up. I already have a way of storing the gameObject the player picks up in a variable. I just want to be able to turn off the collider off of the gameObject that is currently stored in that variable when an event fires.
I'm doing it this way because there will be a large variety of different objects the player can pick up and I don't want to add scripts that do this to each object, but I suppose I could if it comes to that.
-
Probably the only way is to have an FSM on each item. I was going to say just copy and paste, but that won't transfer which collider it's turning off. So I guess copy and paste but remember to drag the actual components in for each one.
-
Yeah that's what I wound up doing, it's not too bad
-
Hi,
If you have the object stored you can use 'Enable Collider' action (Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181))
always try to minimize using Get/Set Properties.
As it uses reflection which is slower than dedicated actions.
also you might need to use Linker Wizard (http://hutonggames.com/playmakerforum/index.php?topic=11126.0) else on some platform the actions won't work.
-
Hey 'enable collider' custom action works great! Thanks djaydino!
I didn't know about get/set not working properly on other platforms, I'll try to minimize my use of those, thanks foro the heads up!
-
always try to minimize using Get/Set Properties.
As it uses reflection which is slower than dedicated actions.
also you might need to use Linker Wizard (http://hutonggames.com/playmakerforum/index.php?topic=11126.0) else on some platform the actions won't work.
Heard this before. Have changed the way I do things now (including finding the Activate Object action). However I have opened an old project full of it. I'm wondering if it's always the same no matter what is actually being Set Property? As in, if you use it to disable a Game Object (not change a component), is that still worse than using Activate Object to turn it on and off?
-
Hi,
if you do this outside the game loop, it's fine ( like to enable a menu or something), but if it's in your game loop, it could affect perf, but that is still something to verify, cause it could be just fine.
Bye,
Jean
-
This old project I've got back in to has it for everything, including to enable game objects that have FSMs in them.