Modding:SaveGame Data Storage: Difference between revisions

From Vintage Story Wiki
Line 84: Line 84:
We attempt to get our list by exposing the <code>GetData</code> method and passing it an identifier for our custom data, in this case our "lfg" list.
We attempt to get our list by exposing the <code>GetData</code> method and passing it an identifier for our custom data, in this case our "lfg" list.


'''Hint''': If nothing is found stored under the identifier, the <code>GetData</code> method returns null. In our mod example, this will happen until at least one player enters the list!
'''Hint''': If nothing is found stored under the key we provide, the <code>GetData</code> method returns null. In our mod example, this will happen until at least one player enters the list!


<code>byte[] data = serverApi.WorldManager.SaveGame.GetData("lfg");</code>
<code>byte[] data = serverApi.WorldManager.SaveGame.GetData("lfg");</code>