Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: nelsonn on June 24, 2017, 02:32:24 PM

Title: Get a GameObject reference from an array
Post by: nelsonn on June 24, 2017, 02:32:24 PM
Hi there,

I've made an array from a number of GameObjects (empty ones just for their positional information). I then get a random entry from that array and I want to get the respective GameObject but all I get is a the index which is a float.

Is there a way to get the correspondent GameObject rather than the index?
Title: Re: Get a GameObject reference from an array
Post by: djaydino on June 24, 2017, 09:23:44 PM
Hi,
Probably you have your array variable not set properly.
If you are not using a float as array it is best to create it in the variable tab.
and set it up, to do this, create an array then click on it and you can set the array type.

The 'Array Get Random' actually does not have an index.

if this is not the case can you show some pics or a video of your states/actions?
Title: Re: Get a GameObject reference from an array
Post by: nelsonn on June 25, 2017, 04:56:26 AM
Thanks for the reply.
I somehow missed the option to create the Array of a specific type it seems...  :-[
It's all working as expected now.