void DrawButton(TiltShiftAssetButton button) { if (button.Prefab == CurrentAsset && button.Prefab != null) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.gray; } if (GUILayout.Button(CreateContent(button), GUILayout.Width(deviceButtons.Width), GUILayout.Height(deviceButtons.Height))) { if (CurrentAsset == button.Prefab) { CurrentAsset = null; } else { CurrentAsset = button.Prefab; } } GUI.backgroundColor = Color.gray; }
GUIContent CreateContent(TiltShiftAssetButton button) { GUIContent content; switch (button.ContentType) { case ButtonContentType.String: content = new GUIContent(button.Title); break; case ButtonContentType.Icon: content = new GUIContent(button.Icon); break; case ButtonContentType.Both: content = new GUIContent(button.Title, button.Icon); break; default: content = new GUIContent(button.Title); break; } return(content); }