playMaker

Author Topic: Get a GameObject reference from an array  (Read 129 times)

nelsonn

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
    • check out my portfolio :)
Get a GameObject reference from an array
« on: June 24, 2017, 11:32:24 AM »
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?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2254
    • View Profile
    • jinxtergames
Re: Get a GameObject reference from an array
« Reply #1 on: June 24, 2017, 06: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?

nelsonn

  • Playmaker Newbie
  • *
  • Posts: 31
    • View Profile
    • check out my portfolio :)
Re: Get a GameObject reference from an array
« Reply #2 on: June 25, 2017, 01: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.