playMaker

Author Topic: Get Random Object by name[SOLVED]  (Read 2787 times)

Sly

  • Full Member
  • ***
  • Posts: 125
Get Random Object by name[SOLVED]
« on: February 13, 2015, 08:46:34 AM »
Hello,

It could be cool to have an action to have a random gameobject (like the Get Random Object) by checking if the name of it contains a certain name in a same action.

For example in my random dungeon generation I would like to find a random gameobject with tag "Room" + it name start with "room_".
If I'm taking the actual action Get Random Object and check it name with action Get name, my FSM could loop for a moment if it didn't find something correct.

Do you think it could be possible?
« Last Edit: February 16, 2015, 10:19:35 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Random Object by name
« Reply #1 on: February 13, 2015, 10:52:56 AM »
Hi,

 Unfortunatyl, that would mean total bad performances, because there is no fast access to gameobject names in the scene.

the way to achieve this is to use for example ArrayMaker and have an fsm that register itself on each of these objects, so that then you can take a random one from an arrayList, which is in turn very fast and sound.

if you the gameobjects exists during editing, then you can fill an array in editor, that's also possible.

 Bye,

 Jean

Sly

  • Full Member
  • ***
  • Posts: 125
Re: Get Random Object by name
« Reply #2 on: February 13, 2015, 12:23:01 PM »
Oh ok. I was thinking about this without having the performance knowledge like you have guys! So I understand.
I was already thinking of the array maker as a backup solution, but finally I will use this.

Merci beaucoup Jean ;)