File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
MLAPI/MonoBehaviours/Core Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -953,17 +953,14 @@ internal void NetworkedVarInit()
953
953
Type fieldType = sortedFields [ i ] . FieldType ;
954
954
if ( fieldType . HasInterface ( typeof ( INetworkedVar ) ) )
955
955
{
956
- INetworkedVar instance = null ;
957
- if ( sortedFields [ i ] . GetValue ( this ) == null )
956
+ INetworkedVar instance = ( INetworkedVar ) sortedFields [ i ] . GetValue ( this ) ;
957
+ if ( instance == null )
958
958
{
959
959
Type genericType = fieldType . MakeGenericType ( fieldType . GetGenericArguments ( ) ) ;
960
960
instance = ( INetworkedVar ) Activator . CreateInstance ( genericType , true ) ;
961
961
sortedFields [ i ] . SetValue ( this , instance ) ;
962
962
}
963
- else
964
- {
965
- instance = ( INetworkedVar ) sortedFields [ i ] . GetValue ( this ) ;
966
- }
963
+
967
964
instance . SetNetworkedBehaviour ( this ) ;
968
965
networkedVarFields . Add ( instance ) ;
969
966
}
You can’t perform that action at this time.
0 commit comments