parent
1b0110320b
commit
47ee45cbbe
|
@ -40,13 +40,26 @@ namespace Coffee.UIExtensions
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
|
private static void InitializeOnLoad()
|
||||||
|
{
|
||||||
|
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
||||||
|
|
||||||
|
EditorApplication.playModeStateChanged += state =>
|
||||||
|
{
|
||||||
|
UIExtraCallbacks.onAfterCanvasRebuild -= Refresh;
|
||||||
|
if (state == PlayModeStateChange.EnteredEditMode || state == PlayModeStateChange.EnteredPlayMode)
|
||||||
|
{
|
||||||
|
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||||
#endif
|
|
||||||
private static void InitializeOnLoad()
|
private static void InitializeOnLoad()
|
||||||
{
|
{
|
||||||
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private static void Refresh()
|
private static void Refresh()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue