/// Adds an instrument to the Music generator and creates its ui object. public void AddMusicGeneratorInstrument(bool isPercussion) { InstrumentSet set = (mMusicGenerator.mState >= eGeneratorState.editorInitializing) ? MeasureEditor.Instance.mCurrentInstSet : mMusicGenerator.mInstrumentSet; List <Instrument> instruments = set.mInstruments; if (instruments.Count < MusicGenerator.mMaxInstruments) { mMusicGenerator.AddInstrument(set); Instrument instrument = set.mInstruments[set.mInstruments.Count - 1]; AddInstrument(instrument); InstrumentListUIObject icon = mInstrumentIcons[mInstrumentIcons.Count - 1]; icon.mInstrument = instruments[instruments.Count - 1]; Color color = StaffPlayerUI.Instance.mColors[(int)icon.mInstrument.mData.mStaffPlayerColor]; icon.mPanelBack.color = color; icon.SetDropdown(isPercussion); } }