Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: tcmeric on June 08, 2017, 10:08:19 AM
-
I am creating action for opsives third person controller (can be found here: https://github.com/dumbgamedev/thirdpersoncontroller_playmaker)
There is a method that returns a list of inventory items. I am trying to figure out how to get that list into a playmaker FSM array or arraymaker array.
Method:
void Opsive.ThirdPersonController.Inventory.GetAvailableItems ( ref List< ItemType > itemTypes)
Returns a list of items which are currently available in the inventory.
itemTypes The list of items which are currently available.
Documentation: https://www.opsive.com/assets/ThirdPersonController/API/class_opsive_1_1_third_person_controller_1_1_inventory.html#a815d5b4f2f50267b7572930771279292
Any ideas or examples?
-
I have found the easiest way to do this is to loop through the list then assign it to the ArrayList.
1) Get the proxy from the game object:
PlayMakerArrayListProxy goProxy = go.GetComponents<PlayMakerArrayListProxy>()
2) Then loop through the List with a foreach and add the info:
foreach (var item in list) {
goProxy._arraylist.Add(item);
}
The key here is the _arraylist. It is what is exposed to access the arraylist data itself.
Hope this helps,
Z