@@ -90,30 +90,41 @@ void RenderNetworkedVarValueType<T>(int index) where T : struct
9090 Type type = typeof ( T ) ;
9191 object val = var . Value ;
9292 string name = networkedVarNames [ index ] ;
93- if ( type == typeof ( int ) )
94- val = EditorGUILayout . IntField ( name , ( int ) val ) ;
95- else if ( type == typeof ( uint ) )
96- val = ( uint ) EditorGUILayout . LongField ( name , ( long ) ( ( uint ) val ) ) ;
97- else if ( type == typeof ( short ) )
98- val = ( short ) EditorGUILayout . IntField ( name , ( int ) ( ( short ) val ) ) ;
99- else if ( type == typeof ( ushort ) )
100- val = ( ushort ) EditorGUILayout . IntField ( name , ( int ) ( ( ushort ) val ) ) ;
101- else if ( type == typeof ( sbyte ) )
102- val = ( sbyte ) EditorGUILayout . IntField ( name , ( int ) ( ( sbyte ) val ) ) ;
103- else if ( type == typeof ( byte ) )
104- val = ( byte ) EditorGUILayout . IntField ( name , ( int ) ( ( byte ) val ) ) ;
105- else if ( type == typeof ( long ) )
106- val = EditorGUILayout . LongField ( name , ( long ) val ) ;
107- else if ( type == typeof ( ulong ) )
108- val = ( ulong ) EditorGUILayout . LongField ( name , ( long ) ( ( ulong ) val ) ) ;
109- else if ( type == typeof ( bool ) )
110- val = EditorGUILayout . Toggle ( name , ( bool ) val ) ;
111- else if ( type == typeof ( string ) )
112- val = EditorGUILayout . TextField ( name , ( string ) val ) ;
113- else
114- EditorGUILayout . LabelField ( "Type not renderable" ) ;
11593
116- var . Value = ( T ) val ;
94+ if ( NetworkingManager . singleton != null && NetworkingManager . singleton . isListening )
95+ {
96+ if ( type == typeof ( int ) )
97+ val = EditorGUILayout . IntField ( name , ( int ) val ) ;
98+ else if ( type == typeof ( uint ) )
99+ val = ( uint ) EditorGUILayout . LongField ( name , ( long ) ( ( uint ) val ) ) ;
100+ else if ( type == typeof ( short ) )
101+ val = ( short ) EditorGUILayout . IntField ( name , ( int ) ( ( short ) val ) ) ;
102+ else if ( type == typeof ( ushort ) )
103+ val = ( ushort ) EditorGUILayout . IntField ( name , ( int ) ( ( ushort ) val ) ) ;
104+ else if ( type == typeof ( sbyte ) )
105+ val = ( sbyte ) EditorGUILayout . IntField ( name , ( int ) ( ( sbyte ) val ) ) ;
106+ else if ( type == typeof ( byte ) )
107+ val = ( byte ) EditorGUILayout . IntField ( name , ( int ) ( ( byte ) val ) ) ;
108+ else if ( type == typeof ( long ) )
109+ val = EditorGUILayout . LongField ( name , ( long ) val ) ;
110+ else if ( type == typeof ( ulong ) )
111+ val = ( ulong ) EditorGUILayout . LongField ( name , ( long ) ( ( ulong ) val ) ) ;
112+ else if ( type == typeof ( bool ) )
113+ val = EditorGUILayout . Toggle ( name , ( bool ) val ) ;
114+ else if ( type == typeof ( string ) )
115+ val = EditorGUILayout . TextField ( name , ( string ) val ) ;
116+ else if ( type . IsEnum )
117+ val = EditorGUILayout . EnumPopup ( name , ( Enum ) val ) ;
118+ else
119+ EditorGUILayout . LabelField ( "Type not renderable" ) ;
120+
121+ var . Value = ( T ) val ;
122+ }
123+ else
124+ {
125+ EditorGUILayout . LabelField ( name , EditorStyles . wordWrappedLabel ) ;
126+ EditorGUILayout . SelectableLabel ( val . ToString ( ) , EditorStyles . wordWrappedLabel ) ;
127+ }
117128 }
118129
119130 public override void OnInspectorGUI ( )
0 commit comments