playMaker

Author Topic: ArrayMaker, Playmaker (and EasySave2?) and Instantiating Prefabs/Assets  (Read 1867 times)

Duffer

  • Playmaker Newbie
  • *
  • Posts: 26
Hi All,

Fairly new to these Forums.

Wondering about how to go about instantiating Prefabs / Assets using Playmaker (and perhaps EasySave2 which I have)?

Joel from the Easy Save forums said the following:-

Quote
Hi there,

You may be best off asking this question on the PlayMaker forums as you will need to use ArrayMaker to do this, which we can't provide support for, but has it's own actions to work with Easy Save. Generally I don't think PlayMaker is very well suited to this, but they'll be able to give you more information.

I imagine the workflow for doing this in PlayMaker would go a bit like this if we wanted to save the position of prefabs and instantiate them:

    Put all of your prefabs into a List (we'll call this prefabList) with ArrayMaker.
    Give each prefab a unique name.
    When you instantiate a prefab:
        Set the instance's name to the same name as the prefab.
        Add the instance to another List (we'll call this instanceList).
    Then when you come to save, do the following:
        Iterate over the instanceList and add add the names of each prefab to a List (namesList), and then each separate piece of data you want to save to it's own individual List (i.e. put the position of each instantiated prefab into positionList)
        Save the namesList and the positionList using the ArrayMaker Easy Save actions.
    Then when you want to load, do the following:
        Clear the createdPrefabs list.
        Load the namesList and positionList.
        Iterate over the namesList and for each name in the list, find the prefab in the prefabList with the same name.
        Use Playmaker's Create Object action to instantiate this prefab and add it to the createdPrefabs list.
        Get the position from your positionList which is at the same index as the current name in your namesList, and apply this position to the object you just created.


Again, hopefully they can find a more eloquent solution for you on the PlayMaker forums as the complex part is less about the actual saving and more about handling a list of prefabs!

All the best,
Joel

Can anyone direct me to some tutorials or provide me with some more insights?

Thanks in advance!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: ArrayMaker, Playmaker (and EasySave2?) and Instantiating Prefabs/Assets
« Reply #1 on: October 14, 2015, 03:09:32 PM »
Hi,
Here is a good place to start :)

Duffer

  • Playmaker Newbie
  • *
  • Posts: 26
Re: ArrayMaker, Playmaker (and EasySave2?) and Instantiating Prefabs/Assets
« Reply #2 on: October 14, 2015, 04:40:30 PM »
Thanks DJaydino - I'll look that up!