Skip to content

Commit afc4598

Browse files
committed
Added support for more array types to SyncedVars
1 parent baa6518 commit afc4598

File tree

2 files changed

+319
-5
lines changed

2 files changed

+319
-5
lines changed

MLAPI/Data/FieldType.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,21 @@ internal enum FieldType
2323
Vector3,
2424
Vector2,
2525
Quaternion,
26+
BoolArray,
2627
ByteArray,
28+
DoubleArray,
29+
SingleArray,
30+
IntArray,
31+
LongArray,
32+
SByteArray,
33+
ShortArray,
34+
UIntArray,
35+
ULongArray,
36+
UShortArray,
37+
StringArray,
38+
Vector3Array,
39+
Vector2Array,
40+
QuaternionArray,
2741
Invalid
2842
}
2943

@@ -61,8 +75,36 @@ internal static FieldType GetFieldType(Type type)
6175
return FieldType.Vector2;
6276
else if (type == typeof(Quaternion))
6377
return FieldType.Quaternion;
78+
else if (type == typeof(bool[]))
79+
return FieldType.BoolArray;
6480
else if (type == typeof(byte[]))
6581
return FieldType.ByteArray;
82+
else if (type == typeof(double[]))
83+
return FieldType.DoubleArray;
84+
else if (type == typeof(float[]))
85+
return FieldType.SingleArray;
86+
else if (type == typeof(int[]))
87+
return FieldType.IntArray;
88+
else if (type == typeof(long[]))
89+
return FieldType.LongArray;
90+
else if (type == typeof(sbyte[]))
91+
return FieldType.SByteArray;
92+
else if (type == typeof(short[]))
93+
return FieldType.ShortArray;
94+
else if (type == typeof(uint[]))
95+
return FieldType.UIntArray;
96+
else if (type == typeof(ulong[]))
97+
return FieldType.ULongArray;
98+
else if (type == typeof(ushort[]))
99+
return FieldType.UShortArray;
100+
else if (type == typeof(string[]))
101+
return FieldType.StringArray;
102+
else if (type == typeof(Vector3[]))
103+
return FieldType.Vector3Array;
104+
else if (type == typeof(Vector2[]))
105+
return FieldType.Vector2Array;
106+
else if (type == typeof(Quaternion[]))
107+
return FieldType.QuaternionArray;
66108
else
67109
return FieldType.Invalid;
68110
}

0 commit comments

Comments
 (0)