jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
110 stars 27 forks source link

Obsolete EditorWindow.title references need to be updated #124

Closed Ghopper21 closed 8 years ago

Ghopper21 commented 9 years ago

Hi there, I'm getting the following two obsolete API warnings (with the full and latest version of FullInspector2):

Assets/Libraries/FullInspector2/Modules/Common/Editor/TypeSelectionPopupWindow.cs(17,20): warning CS0618: UnityEditor.EditorWindow.title' is obsolete:Use titleContent instead (it supports setting a title icon as well).'

and:

Assets/Libraries/FullInspector2/Core/Editor/fiEditorWindowUtility.cs(40,20): warning CS0618: UnityEditor.EditorWindow.title' is obsolete:Use titleContent instead (it supports setting a title icon as well).'

The fix is simple: change the EditorWindow.title references to EditorWindow.titleContent.text.

[I also posted this on the Unity forum thread, before realizing bug reports should go here.]

jacobdufault commented 9 years ago

Is this in 2.6.2? What version of Unity are you on? There should be some ifdefs around those two usages. I'll be able to take a look in a couple of days.

Ghopper21 commented 9 years ago

Yep, the paid version of v2.6.2 (re-imported this weekend). Unity v5.1.0f3 Personal.

jacobdufault commented 9 years ago

I'm really confused by those error messages, since 'title' never appears in TypeSelectionPopupWindow.

The code for fiEditorWindowUtility is

private static void InitializeWindow(EditorWindow window, string title, float windowWidth, float windowHeight) {
    // Unity deprecated window.title in 5.1
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0
    window.title = title;
#else
    window.titleContent = new GUIContent(title);
#endif
    float x = (Screen.currentResolution.width - windowWidth) / 2f;
    float y = (Screen.currentResolution.height - windowHeight) / 2f;
    window.position = new Rect(x, y, windowWidth, windowHeight);
}

which should not be emitting the warning on 5.1. Can you send me what the code snippet looks like for fiEditorWindowUtility.InitializeWindow? Did you do a clean import? Thanks