From fc7b9660a51396569f4d732c793a9b4abedea331 Mon Sep 17 00:00:00 2001 From: neuecc Date: Mon, 21 Sep 2020 12:50:25 +0900 Subject: [PATCH] remove OnMouse_event trigger to prevent warning on Andoird, iOS, #170 --- .../Triggers/MonoBehaviourMessagesTriggers.cs | 14 +++++++++++ .../Triggers/MonoBehaviourMessagesTriggers.tt | 23 ++++++++++++------- .../ProjectSettings/ProjectSettings.asset | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.cs index bbe4271..95c44c5 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.cs @@ -1541,6 +1541,7 @@ namespace Cysharp.Threading.Tasks.Triggers #endregion #region MouseDown +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) public interface IAsyncOnMouseDownHandler { @@ -1597,9 +1598,11 @@ namespace Cysharp.Threading.Tasks.Triggers return ((IAsyncOnMouseDownHandler)new AsyncTriggerHandler(this, cancellationToken, true)).OnMouseDownAsync(); } } +#endif #endregion #region MouseDrag +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) public interface IAsyncOnMouseDragHandler { @@ -1656,9 +1659,11 @@ namespace Cysharp.Threading.Tasks.Triggers return ((IAsyncOnMouseDragHandler)new AsyncTriggerHandler(this, cancellationToken, true)).OnMouseDragAsync(); } } +#endif #endregion #region MouseEnter +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) public interface IAsyncOnMouseEnterHandler { @@ -1715,9 +1720,11 @@ namespace Cysharp.Threading.Tasks.Triggers return ((IAsyncOnMouseEnterHandler)new AsyncTriggerHandler(this, cancellationToken, true)).OnMouseEnterAsync(); } } +#endif #endregion #region MouseExit +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) public interface IAsyncOnMouseExitHandler { @@ -1774,9 +1781,11 @@ namespace Cysharp.Threading.Tasks.Triggers return ((IAsyncOnMouseExitHandler)new AsyncTriggerHandler(this, cancellationToken, true)).OnMouseExitAsync(); } } +#endif #endregion #region MouseOver +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) public interface IAsyncOnMouseOverHandler { @@ -1833,9 +1842,11 @@ namespace Cysharp.Threading.Tasks.Triggers return ((IAsyncOnMouseOverHandler)new AsyncTriggerHandler(this, cancellationToken, true)).OnMouseOverAsync(); } } +#endif #endregion #region MouseUp +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) public interface IAsyncOnMouseUpHandler { @@ -1892,9 +1903,11 @@ namespace Cysharp.Threading.Tasks.Triggers return ((IAsyncOnMouseUpHandler)new AsyncTriggerHandler(this, cancellationToken, true)).OnMouseUpAsync(); } } +#endif #endregion #region MouseUpAsButton +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) public interface IAsyncOnMouseUpAsButtonHandler { @@ -1951,6 +1964,7 @@ namespace Cysharp.Threading.Tasks.Triggers return ((IAsyncOnMouseUpAsButtonHandler)new AsyncTriggerHandler(this, cancellationToken, true)).OnMouseUpAsButtonAsync(); } } +#endif #endregion #region ParticleCollision diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.tt b/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.tt index ce86b6f..4162ba8 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.tt +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.tt @@ -25,13 +25,7 @@ ("Update", "Update", "AsyncUnit", null, empty), ("FixedUpdate", "FixedUpdate", "AsyncUnit", null, empty), ("LateUpdate", "LateUpdate", "AsyncUnit", null, empty), - ("MouseDown", "OnMouseDown", "AsyncUnit", null, empty), - ("MouseDrag", "OnMouseDrag", "AsyncUnit", null, empty), - ("MouseEnter", "OnMouseEnter", "AsyncUnit", null, empty), - ("MouseExit", "OnMouseExit", "AsyncUnit", null, empty), - ("MouseOver", "OnMouseOver", "AsyncUnit", null, empty), - ("MouseUp", "OnMouseUp", "AsyncUnit", null, empty), - ("MouseUpAsButton", "OnMouseUpAsButton", "AsyncUnit", null, empty), + ("ParticleCollision", "OnParticleCollision", "GameObject", null, new []{ ("GameObject", "other") }), ("RectTransformDimensionsChange", "OnRectTransformDimensionsChange", "AsyncUnit", null, empty), ("RectTransformRemoved", "OnRectTransformRemoved", "AsyncUnit", null, empty), @@ -47,6 +41,15 @@ ("BecameInvisible", "OnBecameInvisible", "AsyncUnit", null, empty), ("BecameVisible", "OnBecameVisible", "AsyncUnit", null, empty), + // Mouse... #if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) + ("MouseDown", "OnMouseDown", "AsyncUnit", null, empty), + ("MouseDrag", "OnMouseDrag", "AsyncUnit", null, empty), + ("MouseEnter", "OnMouseEnter", "AsyncUnit", null, empty), + ("MouseExit", "OnMouseExit", "AsyncUnit", null, empty), + ("MouseOver", "OnMouseOver", "AsyncUnit", null, empty), + ("MouseUp", "OnMouseUp", "AsyncUnit", null, empty), + ("MouseUpAsButton", "OnMouseUpAsButton", "AsyncUnit", null, empty), + // new in v2 ("ApplicationFocus", "OnApplicationFocus", "bool", null, new []{("bool", "hasFocus") }), ("ApplicationPause", "OnApplicationPause", "bool", null, new []{("bool", "pauseStatus") }), @@ -104,6 +107,7 @@ Func<(string argType, string argName)[], string> BuildResultParameter = x => x.Length == 0 ? "AsyncUnit.Default" : "(" + string.Join(", ", x.Select(y => y.argName)) + ")"; Func Is2019_3 = x => x == "ParticleUpdateJobScheduled"; + Func IsMouseTrigger = x => x.StartsWith("Mouse"); #> #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member @@ -117,6 +121,9 @@ namespace Cysharp.Threading.Tasks.Triggers #region <#= t.triggerName #> <# if(Is2019_3(t.triggerName)) { #> #if UNITY_2019_3_OR_NEWER +<# } #> +<# if(IsMouseTrigger(t.triggerName)) { #> +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) <# } #> public interface <#= ToInterfaceName(t.methodName) #> @@ -174,7 +181,7 @@ namespace Cysharp.Threading.Tasks.Triggers return ((<#= ToInterfaceName(t.methodName) #>)new AsyncTriggerHandler<<#= t.returnType #>>(this, cancellationToken, true)).<#= t.methodName #>Async(); } } -<# if(Is2019_3(t.triggerName)) { #> +<# if(Is2019_3(t.triggerName) || IsMouseTrigger(t.triggerName)) { #> #endif <# } #> #endregion diff --git a/src/UniTask/ProjectSettings/ProjectSettings.asset b/src/UniTask/ProjectSettings/ProjectSettings.asset index c1a7968..b2e8c6d 100644 --- a/src/UniTask/ProjectSettings/ProjectSettings.asset +++ b/src/UniTask/ProjectSettings/ProjectSettings.asset @@ -543,7 +543,7 @@ PlayerSettings: platformArchitecture: {} scriptingBackend: Android: 1 - Standalone: 0 + Standalone: 1 il2cppCompilerConfiguration: {} managedStrippingLevel: {} incrementalIl2cppBuild: {}