playMaker

Author Topic: Is it possible to Find Game Object by Type?  (Read 1763 times)

HAIRGROW

  • Playmaker Newbie
  • *
  • Posts: 24
Is it possible to Find Game Object by Type?
« 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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is it possible to Find Game Object by Type?
« Reply #1 on: December 21, 2018, 01:27:55 AM »
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.



Bye,

 Jean