@@ -83,36 +83,36 @@ private void OnEnable()
83
83
public override void OnInspectorGUI ( )
84
84
{
85
85
// game dropdown
86
- _gle . romId = EditorGUILayout . TextField ( "ROM ID" , _gle . romId ) ;
87
-
88
- // EditorGUI.BeginChangeCheck();
89
- // _selectedGameIndex = EditorGUILayout.Popup("Game", _selectedGameIndex, _gameNames);
90
- // if (EditorGUI.EndChangeCheck()) {
91
- // _selectedRomIndex = 0;
92
- // if (_selectedGameIndex > 0) {
93
- // _gle.Game = _games[_selectedGameIndex - 1];
94
- // _gle.romId = Rom.Id;
95
- // _romNames = _gle.Game.Roms.Select(g => g.ToString()).ToArray();
96
- //
97
- // } else {
98
- // _gle.Game = null;
99
- // _gle.romId = string.Empty;
100
- // _romNames = new string[0];
101
- // }
102
- // }
103
-
104
- // rom dropdown
105
- // EditorGUI.BeginDisabledGroup(_gle.Game == null);
106
- // EditorGUI.BeginChangeCheck();
107
- // _selectedRomIndex = EditorGUILayout.Popup("ROM", _selectedRomIndex, _romNames);
108
- // if (EditorGUI.EndChangeCheck()) {
109
- // _gle.romId = Rom.Id;
110
- // }
111
- //
112
- // // info label
113
- // EditorGUILayout.LabelField("ROM ID", _gle.romId);
86
+ //_gle.romId = EditorGUILayout.TextField("ROM ID", _gle.romId);
114
87
115
- //EditorGUI.EndDisabledGroup();
88
+ EditorGUI . BeginChangeCheck ( ) ;
89
+ _selectedGameIndex = EditorGUILayout . Popup ( "Game" , _selectedGameIndex , _gameNames ) ;
90
+ if ( EditorGUI . EndChangeCheck ( ) ) {
91
+ _selectedRomIndex = 0 ;
92
+ if ( _selectedGameIndex > 0 ) {
93
+ _gle . Game = _games [ _selectedGameIndex - 1 ] ;
94
+ _gle . romId = Rom . Id ;
95
+ _romNames = _gle . Game . Roms . Select ( g => g . ToString ( ) ) . ToArray ( ) ;
96
+
97
+ } else {
98
+ _gle . Game = null ;
99
+ _gle . romId = string . Empty ;
100
+ _romNames = new string [ 0 ] ;
101
+ }
102
+ }
103
+
104
+ //rom dropdown
105
+ EditorGUI . BeginDisabledGroup ( _gle . Game == null ) ;
106
+ EditorGUI . BeginChangeCheck ( ) ;
107
+ _selectedRomIndex = EditorGUILayout . Popup ( "ROM" , _selectedRomIndex , _romNames ) ;
108
+ if ( EditorGUI . EndChangeCheck ( ) ) {
109
+ _gle . romId = Rom . Id ;
110
+ }
111
+
112
+ // info label
113
+ EditorGUILayout . LabelField ( "ROM ID" , _gle . romId ) ;
114
+
115
+ EditorGUI . EndDisabledGroup ( ) ;
116
116
117
117
EditorGUILayout . Space ( ) ;
118
118
EditorGUILayout . Separator ( ) ;
@@ -227,9 +227,16 @@ private void CreateDisplays(IEnumerable<DisplayAuthoring> sceneDisplays)
227
227
tableHeight + ( numRows - top ) * charHeight ,
228
228
1.1f ) ;
229
229
}
230
+
231
+ displayGameObjects . Remove ( id ) ;
230
232
}
231
233
var str = string . Join ( "\n " , displayLayouts . Keys . Select ( t => $ "{ t } : { displayLayouts [ t ] } ") ) ;
232
234
Debug . Log ( $ "OnDisplaysAvailable ({ displayLayouts . Count } ): displays=\n { str } \n { tableWidth } - { totalWidth } ") ;
235
+
236
+ // remove non-updated game objects.
237
+ foreach ( var displayAuthoring in displayGameObjects . Values ) {
238
+ DestroyImmediate ( displayAuthoring . gameObject ) ;
239
+ }
233
240
}
234
241
235
242
private static int ConvertSeparatorType ( PinMameDisplayType layoutType )
0 commit comments