Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: unclebob on September 17, 2014, 10:47:22 AM
-
Hi
I have a situation where I want to populate an array with data that has been gathered and stored from a C# script very like the one below.
}
DirectoryInfo dir = new DirectoryInfo(Application.persistentDataPath);
FileInfo[] images = dir.GetFiles("*.png");
foreach (FileInfo f in images)
{
I know how to pass individual items to an FSM using for instance:
FsmVariables.GlobalVariables.GetFsmString("tess").Value = Storedstring;
But is there a simple method of doing this with arrays? My brain has stopped working hence the need for pointers. ???
So far I have created a "Game Object" variable and set it to Object Type PlayMakerArrayListProxy and set the Object Value to the Object the Proxy is on "Data".
I have also read that
public PlayMakerArrayListProxy myArrayListProxy;
Gives visibility in C#
But when your brain starts hurting we all know we should ask for help so...help please!
Thank you in advance.
-
Hi,
ok. you need to do the following:
1: get a pointer to the PlayMakerArrayListProxy component
2: access the arrayList via the property _arrayList
and that's it, then _arrayList is a regular c# "ArrayList"
Does that answer your question? or do you have problem with c# to populate any array to being with?
Bye,
Jean
-
Thanks Jean.
Can I ask how I can populate an array using external data like an xls spreadsheet?
Cheers
Unclebob
-
Hi,
you'll have to do your parser manually. I have an example in the arrayMaker samples where I take a text files and populate an array with each lines, so you can do some basic parsing this way, but coming from a complex csv or database, it's not covered.
Bye,
Jean