Now that LookLikeInspector() is obsolete, what do I use?

The changelog here states that it has been replaced with “a single unified look,” but what does that mean?

I think it means that Unity will just display that information all in one way instead of giving you the option of LookLikeInspector and LookLikeControls, although I have never used the two so I may be mistaken.

I thought so too, but I can't find the single option anywhere, and it's not enabled by default. EditorGUIUtility.LookLikeControls() doesn't do it either.

2 Answers

2

These methods were replaced with the following static properties:

Replace your usage of EditorGUIUtility.LookLikeControls with:

// Instead of:
EditorGUIUtility.LookLikeControls(25, 50);

// Use:
EditorGUIUtility.labelWidth = 25;
EditorGUIUtility.fieldWidth = 50;

Replace your usage of EditorGUIUtility.LookLikeInspector with:

// Instead of:
EditorGUIUtility.LookLikeInspector();

// Use:
EditorGUIUtility.labelWidth = 0;
EditorGUIUtility.fieldWidth = 0;

You may have noticed that the inspector became indented since Unity 4.3. This can be overridden by using the following:

// Just in case Unity reverse this change...
// Let's restore the current wideMode when we are finished with it!
bool restoreWideMode = EditorGUIUtility.wideMode;
EditorGUIUtility.wideMode = true;

// Your stuff as normal...

EditorGUIUtility.wideMode = restoreWideMode;

Thanks, it solve my problem.

There is only one function now, and it is EditorGUIUtility.LookLikeControls(). There is also an overload of it that takes two floats for label widths and field widths.