@@ -28,9 +28,9 @@ internal static class CodeGenHelpers
2828 public static readonly string ServerRpcParams_FullName = typeof ( ServerRpcParams ) . FullName ;
2929 public static readonly string ClientRpcParams_FullName = typeof ( ClientRpcParams ) . FullName ;
3030 public static readonly string INetworkSerializable_FullName = typeof ( INetworkSerializable ) . FullName ;
31- public static readonly string INetworkSerializable_NetworkRead_Name = nameof ( INetworkSerializable . NetworkRead ) ;
32- public static readonly string INetworkSerializable_NetworkWrite_Name = nameof ( INetworkSerializable . NetworkWrite ) ;
31+ public static readonly string INetworkSerializable_NetworkSerialize_Name = nameof ( INetworkSerializable . NetworkSerialize ) ;
3332 public static readonly string UnityColor_FullName = typeof ( Color ) . FullName ;
33+ public static readonly string UnityColor32_FullName = typeof ( Color32 ) . FullName ;
3434 public static readonly string UnityVector2_FullName = typeof ( Vector2 ) . FullName ;
3535 public static readonly string UnityVector3_FullName = typeof ( Vector3 ) . FullName ;
3636 public static readonly string UnityVector4_FullName = typeof ( Vector4 ) . FullName ;
@@ -78,6 +78,8 @@ public static bool IsSubclassOf(this TypeDefinition typeDefinition, string Class
7878
7979 public static bool HasInterface ( this TypeReference typeReference , string InterfaceTypeFullName )
8080 {
81+ if ( typeReference . IsArray ) return false ;
82+
8183 try
8284 {
8385 var typeDef = typeReference . Resolve ( ) ;
@@ -91,11 +93,11 @@ public static bool HasInterface(this TypeReference typeReference, string Interfa
9193 return false ;
9294 }
9395
94- public static bool IsSupportedType ( this TypeReference typeReference )
96+ public static bool IsSerializable ( this TypeReference typeReference )
9597 {
9698 var typeSystem = typeReference . Module . TypeSystem ;
9799
98- // common primitives
100+ // C# primitives
99101 if ( typeReference == typeSystem . Boolean ) return true ;
100102 if ( typeReference == typeSystem . Char ) return true ;
101103 if ( typeReference == typeSystem . SByte ) return true ;
@@ -112,31 +114,30 @@ public static bool IsSupportedType(this TypeReference typeReference)
112114
113115 // Unity primitives
114116 if ( typeReference . FullName == UnityColor_FullName ) return true ;
117+ if ( typeReference . FullName == UnityColor32_FullName ) return true ;
115118 if ( typeReference . FullName == UnityVector2_FullName ) return true ;
116119 if ( typeReference . FullName == UnityVector3_FullName ) return true ;
117120 if ( typeReference . FullName == UnityVector4_FullName ) return true ;
118121 if ( typeReference . FullName == UnityQuaternion_FullName ) return true ;
119122 if ( typeReference . FullName == UnityRay_FullName ) return true ;
120123 if ( typeReference . FullName == UnityRay2D_FullName ) return true ;
121124
122- // INetworkSerializable
123- if ( typeReference . HasInterface ( INetworkSerializable_FullName ) ) return true ;
124-
125125 // Enum
126126 if ( typeReference . GetEnumAsInt ( ) != null ) return true ;
127127
128- // todo: [RFC] Serializable Types
129- // StaticArray[]
130- // IEnumerable<T>
131- // IEnumerable<KeyValuePair<K, V>>
132- // IEnumerable<Tuple<T1, T2, T3...T7>>
133- // IEnumerable<Tuple<T1, T2...TRest>>
128+ // INetworkSerializable
129+ if ( typeReference . HasInterface ( INetworkSerializable_FullName ) ) return true ;
130+
131+ // Static array
132+ if ( typeReference . IsArray ) return typeReference . GetElementType ( ) . IsSerializable ( ) ;
134133
135134 return false ;
136135 }
137136
138137 public static TypeReference GetEnumAsInt ( this TypeReference typeReference )
139138 {
139+ if ( typeReference . IsArray ) return null ;
140+
140141 try
141142 {
142143 var typeDef = typeReference . Resolve ( ) ;
0 commit comments