static void ListRefresh() { mDeviceInfo = UnityAndroidUSBDebug.getDevices(); var serial = string.Empty; if (null == mContent) { serial = UnityAndroidUSBDebug.getDeviceSerial(); } else { serial = mContent[mIndex].text; } { var count = mDeviceInfo.Count; mContent = new GUIContent[count]; for (int index = 0; index < count; ++index) { var content = new GUIContent(); content.text = mDeviceInfo[index].mSerial; content.tooltip = mDeviceInfo[index].mDesc; mContent[index] = content; } } selectSerial(serial); }
void OnGUI() { if (GUILayout.Button("Refresh")) { ListRefresh(); } var index = EditorGUILayout.Popup(mIndex, mContent); if (index != mIndex) { UnityAndroidUSBDebug.setDeviceSerial(mContent[index].text); } mIndex = index; }