Merged in experimental/unity2018_3 (pull request #40)

Testing branch for 2018.3Updated source to work with 2018.3 without errors

Approved-by: Simon Jackson <darkside@xna-uk.net>
pull/413/head
Simon Jackson 2019-01-07 11:19:24 +00:00
commit ee23104372
3 changed files with 13 additions and 2 deletions

View File

@ -139,9 +139,15 @@ namespace UnityEngine.UI.Extensions
// Update rects since other things might affect them even if value didn't change. // Update rects since other things might affect them even if value didn't change.
if(!Application.isPlaying) UpdateVisuals(); if(!Application.isPlaying) UpdateVisuals();
#if UNITY_2018_3_OR_NEWER
if (!Application.isPlaying)
#else
var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this);
if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying)
#endif
{
CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this);
}
} }
#endif // if UNITY_EDITOR #endif // if UNITY_EDITOR

View File

@ -118,7 +118,7 @@ namespace UnityEngine.UI.Extensions {
} }
protected void UpdateQuadImage() { protected void UpdateQuadImage() {
#if UNITY_EDITOR #if UNITY_EDITOR && !UNITY_2018_3_OR_NEWER
if (UnityEditor.PrefabUtility.GetPrefabType(this) == UnityEditor.PrefabType.Prefab) { if (UnityEditor.PrefabUtility.GetPrefabType(this) == UnityEditor.PrefabType.Prefab) {
return; return;
} }

View File

@ -89,10 +89,15 @@ namespace UnityEngine.UI
base.OnValidate(); base.OnValidate();
Set(m_IsOn, false); Set(m_IsOn, false);
PlayEffect(toggleTransition == ToggleTransition.None); PlayEffect(toggleTransition == ToggleTransition.None);
#if UNITY_2018_3_OR_NEWER
if (!Application.isPlaying)
#else
var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this);
if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying)
#endif
{
CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this);
}
} }
#endif // if UNITY_EDITOR #endif // if UNITY_EDITOR