Added Serializable and SerializeField

This commit is contained in:
MrGadget 2020-01-14 19:32:39 -05:00 committed by GitHub
parent 7011fade2d
commit 98652e708f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,17 +22,20 @@ To use it, create a class that derives from SyncDictionary for your specific typ
using UnityEngine;
using Mirror;
[System.Serializable]
public struct Item
{
public string name;
public int hitPoints;
public int durability;
}
[System.Serializable]
public class SyncDictionaryStringItem : SyncDictionary<string, Item> {}
public class ExamplePlayer : NetworkBehaviour
{
public class SyncDictionaryStringItem : SyncDictionary<string, Item> {}
public struct Item
{
public string name;
public int hitPoints;
public int durability;
}
[SerializeField]
public readonly SyncDictionaryStringItem Equipment = new SyncDictionaryStringItem();
public override void OnStartServer()