Commits

Tenebrous committed 2973c37

Stop things breaking in later Unity versions.

Comments (0)

Files changed (1)

EditorEnhancements/Editor/Common.cs

  * Latest version: http://hg.tenebrous.co.uk/unityeditorenhancements/wiki/Home
 */
 
+#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6
+#define UNITY_4
+#endif
+
 using System.IO;
 using UnityEngine;
 using UnityEditor;
 
 		public static Texture GetMiniThumbnail( UnityEngine.Object obj )
 		{
-#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3
+#if UNITY_4
 			return ( AssetPreview.GetMiniThumbnail( obj ) );
 #else
 			return ( EditorUtility.GetMiniThumbnail( obj ) );
 
 		public static Texture2D GetAssetPreview( UnityEngine.Object obj )
 		{
-#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3
+#if UNITY_4
 			return ( AssetPreview.GetAssetPreview( obj ) );
 #else
 			return ( EditorUtility.GetAssetPreview( obj ) );
 		{
 			get
 			{
-				_projectWindow = _projectWindow ?? GetWindowByName("UnityEditor.ProjectWindow") ?? GetWindowByName("UnityEditor.ObjectBrowser") ?? GetWindowByName("UnityEditor.ProjectBrowser");
+				_projectWindow = _projectWindow 
+							  ?? GetWindowByName("UnityEditor.ProjectWindow") 
+							  ?? GetWindowByName("UnityEditor.ObjectBrowser") 
+							  ?? GetWindowByName("UnityEditor.ProjectBrowser");
+
 				return ( _projectWindow );
 			}
 		}
 		{
 			get
 			{
-				_hierarchyWindow = _hierarchyWindow ?? GetWindowByName( "UnityEditor.HierarchyWindow" );
+				_hierarchyWindow = _hierarchyWindow 
+								?? GetWindowByName( "UnityEditor.HierarchyWindow" )
+								?? GetWindowByName( "UnityEditor.SceneHierarchyWindow" );
+
 				return ( _hierarchyWindow );
 			}
 		}