Playmaker Forum
PlayMaker News => General Discussion => Topic started by: HAIRGROW on December 20, 2018, 03:07:28 PM
-
So instead using Find Game Object by Tag or Name, I'm wondering if it's possible to find a Game Object by Component. I'm trying to write my own custom action for this and have looked at the Get Component action as a reference but unfortunately I can't use FindObjectOfType within the HutongGame.PlayMaker.Actions namespace. Any help would be appreciated.
-
Hi,
What makes you say that you can't use FindObjectOfType inside an Action? you can.
I just made it, it's on the ecosystem: FindGameObjectByType
however, you are going to have a problem to expose the list of types, for this, you might want to use this: https://bitbucket.org/rotorz/classtypereference-for-unity
also, types are too general and broad, what you want actually, is find by component right? so maybe you should let the dev select a component type, the get that component's type and find it like that.
so I used a string, make sure you run proper tests that the type you want to get is a valid type.
(https://i.imgur.com/mWThcDb.png)
Bye,
Jean