Unity 2018.2.2f1 AC 1.64.1
In my current game I've got multiple potential Players. They can exchange inventory items by using one of the many scene-specific local containers scattered around the game world (which consists of numerous linked screens)
I've got two extra requirements though:
1) I'd like a "Global" container, which could be used by any Player in any Scene. In other words, if Player A puts Item X into it in Scene Y, then if Player B opens it in Scene Z, then it will still contain Item X
2) On the same lines, I'd like for Players to be able to exchange items between themselves, probably by means of a similar "Global Container" mechanism. I think if I can crack the first option, then this would just be a variation of it
So, what I've tried so far is to set up a Container Prefab Object. The Prefab contains a Container script, and a RememberContainer script, with "Retain In Prefab" ticked. It is not limited by Category
As a test I've got two different scenes, each of which has a Hotspot instigated ActionList which simply runs an "OpenContainer" Action, specifying the Prefab Container, which allows different Players to add and remove items from the Prefab Container
That works as expected. Put an item in the Container in Scene 1, and it will then be available in the Container when opened in Scene 2, etc
But, it's working directly on the Prefab, so, on exiting from the game the Container Prefab is left in its last state. Well, that's not too terrible, because I want this particular Container to be empty at the start of the game, so I simply run a "Container/Remove All" when the game starts, and everything is fine...
...except (and there's always an "except")... except that if the Player makes some Inventory changes to the Container and then does a Save and Reload, the Container Prefab doesn't reload its state from when it was saved, it is simply empty
So, really the questions are:
1) Am I going about this in the right way?
2) If so, do I need to write something extra to save and reload the Prefab Container data?
3) If so, do you have any pointers on how to approach it?
4) Or, um, something else...?
Comments
Hi guys. Thank you again for this script, I thought I had answered back then, it worked!! for a while... Because after a few updates, the SyncContainers.cs stopped working. Is there a new way of doing this that I have missed, or could somebody help me with the script? It gives a few different errors type like CS1061: 'SceneChanger' does not contain.... and for now I've been ignoring it, but its time for me to face the music
thank you again!
ok, for now my workaround is this:
So, as long as these works too, I guess we are golden, but let me know if I'm missing or way off.
thanks again
By "checking", you're referring to the use of the "Container: Check" Action?
There shouldn't be a requirement to use that for it to work - can you explain the issue that you're trying to solve with it?