playMaker

Author Topic: Accessing array on another class from a FSM  (Read 2070 times)

cdutoit

  • Playmaker Newbie
  • *
  • Posts: 28
Accessing array on another class from a FSM
« on: September 01, 2014, 06:04:29 PM »
Hello -

Struggling with something and looking for guidance/pointers. I'm relatively new to both PM and Unity so excuse my ignorance ;)

On my Main Camera game object, there is a 3rd party Script attached to it which has a public array on it amongst others.

Now, on another gameobject, inside my FSM, I want to add an element to that array on the camera object.

I know there is an ArrayMaker add-on, but I want to know how do I access that array on the other game object? In the script source code declaring the array, it is defined as public.

Any help appreciated.

Thanks

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Accessing array on another class from a FSM
« Reply #1 on: September 01, 2014, 07:25:28 PM »
Have you tried using the "get property" action? Drop the script with the array in there and see if you can access it
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

cdutoit

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Accessing array on another class from a FSM
« Reply #2 on: September 01, 2014, 09:07:24 PM »
Thanks, mdotstrange.

I tried the get property thanks...but it seems it only returns primitive types. It doesn't let you "see" an array. So I can't use that unfortunately.

Can't believe I'm so stumped trying to accomplish something so simple :( I'll keep fighting it but if anyone has ideas, please share!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Accessing array on another class from a FSM
« Reply #3 on: September 01, 2014, 09:20:24 PM »
Yeh sometimes its tough to get 3rd party scripts to interact with PM- most of the time I try to just rebuild the functionality with PM-

Perhaps you need another script that can add to the array? Then you can execute the script with PM by enabling/disabling it-

btw Arraymaker is pretty easy to use once you understand the basics if you want to rebuild the arrays functionality in PM
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!