I really appreciate if anyone could help here , i stuck from last 9 days sync a array using UNet in unity , so i had asked couple of diff. types of question in unity but none get a answer . I really hope BrackeyForum helps me out .
According to this Documentation In Unity http://docs.unity3d.com/Manual/UNetStateSync.html , we can use arrays while using SyncListStruct , but unknowably in Runtime when using SyncListStruct containing a array it throws a error.
InvalidProgramException: Invalid IL code in SendMeshToServer/TestMeshData:SerializeItem (UnityEngine.Networking.NetworkWriter,SendMeshToServer/MeshData): IL_001f: call 0x0a000016 UnityEngine.Networking.SyncList`1[SendMeshToServer+MeshData].SendMsg (Operation op, Int32 itemIndex, MeshData item)
Heres my script :
public struct MeshData { public int point ; public int[] points ; }; public class TestMeshData : SyncListStruct<MeshData> {} TestMeshData _testMeshData = new TestMeshData () ; int[] tempPoints ; MeshData _meshData ; void Start() { tempPoints = new int[5] ; } void Update() { if (Input.GetKey(KeyCode.Q)) { _meshData.point += 5 ; _meshData.points = tempPoints ; _testMeshData.Add(_meshData) ; } }