Instantaneous EditorGUILayout.ColorField

Hi there,

I’m using EditorGUILayout.ColorField to have a custom color field on an object. I’d like to be able to apply the selected color while the Color Picker Window is open. Currently, the Color Picker Window must be closed in order for the selected color to be applied.

How can I get the data from the Color Picker Window while it is still open?

I found my own answers.

So EditorGUILayout.ColorField was returning the color from the Color Picker instantaneously. The GameView simply wasnt repainting until I closed the Color Picker.

There’s a couple ways to redraw the GameView:

  1. Set a gameObject disabled and renabled (gross!)

  2. UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); (SLOW)

  3. my special hack (fast)

static EditorWindow gameview;
void OnEnable() {
	if (gameview == null) {
		System.Reflection.Assembly assembly = typeof(UnityEditor.EditorWindow).Assembly;
		System.Type type = assembly.GetType( "UnityEditor.GameView" );
		gameview = EditorWindow.GetWindow(type);
void OnDisable() {
	gameview = null;
private void Repaint2() {
	if (gameview != null) {

This method is faster than using RepaintAllViews.