diff --git a/Assets/Scenes/SandboxMain.cs b/Assets/Scenes/SandboxMain.cs index 158da1d..201a91b 100644 --- a/Assets/Scenes/SandboxMain.cs +++ b/Assets/Scenes/SandboxMain.cs @@ -1,20 +1,33 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; +using System.Threading; using UniRx.Async; using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; public class SandboxMain : MonoBehaviour { - // Start is called before the first frame update - void Start() - { - RunAsync().Forget(); - } + public Button okButton; + public Button cancelButton; + CancellationTokenSource cts; - async UniTaskVoid RunAsync() + async void Start() { - var id = await UniTask.Run(() => System.Threading.Thread.CurrentThread.ManagedThreadId, configureAwait: false); - UnityEngine.Debug.Log("ReturnId:" + id); - UnityEngine.Debug.Log("CurrentId:" + System.Threading.Thread.CurrentThread.ManagedThreadId); + await UniTask.CompletedTask; // ok + + // var subject = new Subject(); + //subject.OnCompleted(); + IObservable subject = default; + try + { + await subject.ToUniTask(); // exception + } + catch (Exception exception) + { + Debug.Log(exception); + } } } + diff --git a/Assets/Scenes/SandboxMain.unity b/Assets/Scenes/SandboxMain.unity index c133514..59e7906 100644 --- a/Assets/Scenes/SandboxMain.unity +++ b/Assets/Scenes/SandboxMain.unity @@ -120,6 +120,127 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &16537670 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 16537671} + - component: {fileID: 16537674} + - component: {fileID: 16537673} + - component: {fileID: 16537672} + m_Layer: 0 + m_Name: StartButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &16537671 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16537670} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1584557232} + m_Father: {fileID: 1556045508} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -7, y: 226} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &16537672 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16537670} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 16537673} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &16537673 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16537670} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &16537674 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16537670} + m_CullTransparentMesh: 0 --- !u!1 &519420028 GameObject: m_ObjectHideFlags: 0 @@ -159,6 +280,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f0bc6c75abb2e0b47a25aa49bfd488ed, type: 3} m_Name: m_EditorClassIdentifier: + okButton: {fileID: 16537672} + cancelButton: {fileID: 628393011} --- !u!20 &519420031 Camera: m_ObjectHideFlags: 0 @@ -216,3 +339,450 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &628393009 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 628393010} + - component: {fileID: 628393013} + - component: {fileID: 628393012} + - component: {fileID: 628393011} + m_Layer: 0 + m_Name: CancelButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &628393010 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 628393009} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 865871445} + m_Father: {fileID: 1556045508} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -4.9, y: 179} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &628393011 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 628393009} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 628393012} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &628393012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 628393009} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &628393013 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 628393009} + m_CullTransparentMesh: 0 +--- !u!1 &865871444 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 865871445} + - component: {fileID: 865871447} + - component: {fileID: 865871446} + m_Layer: 0 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &865871445 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 865871444} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 628393010} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &865871446 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 865871444} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Cancel +--- !u!222 &865871447 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 865871444} + m_CullTransparentMesh: 0 +--- !u!1 &872009839 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 872009842} + - component: {fileID: 872009841} + - component: {fileID: 872009840} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &872009840 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 872009839} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &872009841 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 872009839} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &872009842 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 872009839} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1556045504 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1556045508} + - component: {fileID: 1556045507} + - component: {fileID: 1556045506} + - component: {fileID: 1556045505} + m_Layer: 0 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1556045505 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1556045504} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1556045506 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1556045504} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1556045507 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1556045504} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1556045508 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1556045504} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 16537671} + - {fileID: 628393010} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1584557231 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1584557232} + - component: {fileID: 1584557234} + - component: {fileID: 1584557233} + m_Layer: 0 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1584557232 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1584557231} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 16537671} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1584557233 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1584557231} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Start + +' +--- !u!222 &1584557234 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1584557231} + m_CullTransparentMesh: 0 diff --git a/Assets/UniRx.Async/CompilerServices/AsyncMethodBuilderAttribute.cs b/Assets/UniRx.Async/CompilerServices/AsyncMethodBuilderAttribute.cs index b9658c9..06528cf 100644 --- a/Assets/UniRx.Async/CompilerServices/AsyncMethodBuilderAttribute.cs +++ b/Assets/UniRx.Async/CompilerServices/AsyncMethodBuilderAttribute.cs @@ -4,7 +4,7 @@ namespace System.Runtime.CompilerServices { - public sealed class AsyncMethodBuilderAttribute : Attribute + internal sealed class AsyncMethodBuilderAttribute : Attribute { public Type BuilderType { get; } diff --git a/Assets/UniRx.Async/EnumeratorAsyncExtensions.cs b/Assets/UniRx.Async/EnumeratorAsyncExtensions.cs index 5f3411e..2d3114a 100644 --- a/Assets/UniRx.Async/EnumeratorAsyncExtensions.cs +++ b/Assets/UniRx.Async/EnumeratorAsyncExtensions.cs @@ -3,9 +3,11 @@ using System; using System.Collections; +using System.Reflection; using System.Runtime.ExceptionServices; using System.Threading; using UniRx.Async.Internal; +using UnityEngine; namespace UniRx.Async { @@ -57,7 +59,7 @@ namespace UniRx.Async return; } - this.innerEnumerator = innerEnumerator; + this.innerEnumerator = ConsumeEnumerator(innerEnumerator); this.status = AwaiterStatus.Pending; this.cancellationToken = cancellationToken; this.continuation = null; @@ -142,6 +144,108 @@ namespace UniRx.Async Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); this.continuation = continuation; } + + // Unwrap YieldInstructions + + static IEnumerator ConsumeEnumerator(IEnumerator enumerator) + { + while (enumerator.MoveNext()) + { + var current = enumerator.Current; + if (current == null) + { + yield return null; + } + else if (current is CustomYieldInstruction) + { + // WWW, WaitForSecondsRealtime + var e2 = UnwrapWaitCustomYieldInstruction((CustomYieldInstruction)current); + while (e2.MoveNext()) + { + yield return null; + } + } + else if (current is YieldInstruction) + { + IEnumerator innerCoroutine = null; + switch (current) + { + case AsyncOperation ao: + innerCoroutine = UnwrapWaitAsyncOperation(ao); + break; + case WaitForSeconds wfs: + innerCoroutine = UnwrapWaitForSeconds(wfs); + break; + } + if (innerCoroutine != null) + { + while (innerCoroutine.MoveNext()) + { + yield return null; + } + } + else + { + yield return null; + } + } + else if (current is IEnumerator e3) + { + while (e3.MoveNext()) + { + yield return null; + } + } + else + { + // WaitForEndOfFrame, WaitForFixedUpdate, others. + yield return null; + } + } + } + + // WWW and others as CustomYieldInstruction. + static IEnumerator UnwrapWaitCustomYieldInstruction(CustomYieldInstruction yieldInstruction) + { + while (yieldInstruction.keepWaiting) + { + yield return null; + } + } + + static readonly FieldInfo waitForSeconds_Seconds = typeof(WaitForSeconds).GetField("m_Seconds", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic); + + static IEnumerator UnwrapWaitForSeconds(WaitForSeconds waitForSeconds) + { + var second = (float)waitForSeconds_Seconds.GetValue(waitForSeconds); + var startTime = DateTimeOffset.UtcNow; + while (true) + { + yield return null; + + var elapsed = (DateTimeOffset.UtcNow - startTime).TotalSeconds; + if (elapsed >= second) + { + break; + } + }; + } + + static IEnumerator UnwrapEnumerator(IEnumerator enumerator) + { + while (enumerator.MoveNext()) + { + yield return null; + } + } + + static IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation) + { + while (!asyncOperation.isDone) + { + yield return null; + } + } } } } diff --git a/Assets/UniRx.Async/Triggers/AsyncAnimatorTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncAnimatorTrigger.cs index 00b66cb..2a294d7 100644 --- a/Assets/UniRx.Async/Triggers/AsyncAnimatorTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncAnimatorTrigger.cs @@ -29,7 +29,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnAnimatorIKAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnAnimatorIKAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onAnimatorIK, ref onAnimatorIKs, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncBeginDragTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncBeginDragTrigger.cs index bef1037..e17664b 100644 --- a/Assets/UniRx.Async/Triggers/AsyncBeginDragTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncBeginDragTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onBeginDrag, ref onBeginDrags, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncCancelTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncCancelTrigger.cs index f484e59..f397dde 100644 --- a/Assets/UniRx.Async/Triggers/AsyncCancelTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncCancelTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCancel, ref onCancels, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncCollision2DTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncCollision2DTrigger.cs index c3f0c9c..0f0b747 100644 --- a/Assets/UniRx.Async/Triggers/AsyncCollision2DTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncCollision2DTrigger.cs @@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCollisionEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCollisionEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCollisionEnter2D, ref onCollisionEnter2Ds, cancellationToken); } @@ -44,7 +44,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCollisionExit2DAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCollisionExit2DAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCollisionExit2D, ref onCollisionExit2Ds, cancellationToken); } @@ -56,7 +56,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCollisionStay2DAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCollisionStay2DAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCollisionStay2D, ref onCollisionStay2Ds, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncCollisionTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncCollisionTrigger.cs index 3534c69..71306df 100644 --- a/Assets/UniRx.Async/Triggers/AsyncCollisionTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncCollisionTrigger.cs @@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCollisionEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCollisionEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCollisionEnter, ref onCollisionEnters, cancellationToken); } @@ -44,7 +44,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCollisionExitAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCollisionExitAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCollisionExit, ref onCollisionExits, cancellationToken); } @@ -56,7 +56,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCollisionStayAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCollisionStayAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCollisionStay, ref onCollisionStays, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncDeselectTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncDeselectTrigger.cs index 18ac7d0..e1e7ce4 100644 --- a/Assets/UniRx.Async/Triggers/AsyncDeselectTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncDeselectTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onDeselect, ref onDeselects, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncDragTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncDragTrigger.cs index 46ad8d9..b1e4d56 100644 --- a/Assets/UniRx.Async/Triggers/AsyncDragTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncDragTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onDrag, ref onDrags, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncDropTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncDropTrigger.cs index 8993952..7042c4d 100644 --- a/Assets/UniRx.Async/Triggers/AsyncDropTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncDropTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnDropAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnDropAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onDrop, ref onDrops, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncEndDragTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncEndDragTrigger.cs index cbaa823..2b4ce34 100644 --- a/Assets/UniRx.Async/Triggers/AsyncEndDragTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncEndDragTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onEndDrag, ref onEndDrags, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncEventTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncEventTrigger.cs index 218fedc..17568d2 100644 --- a/Assets/UniRx.Async/Triggers/AsyncEventTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncEventTrigger.cs @@ -59,7 +59,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onDeselect, ref onDeselects, cancellationToken); } @@ -71,7 +71,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onMove, ref onMoves, cancellationToken); } @@ -83,7 +83,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerDown, ref onPointerDowns, cancellationToken); } @@ -95,7 +95,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerEnter, ref onPointerEnters, cancellationToken); } @@ -107,7 +107,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerExit, ref onPointerExits, cancellationToken); } @@ -119,7 +119,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerUp, ref onPointerUps, cancellationToken); } @@ -131,7 +131,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onSelect, ref onSelects, cancellationToken); } @@ -143,7 +143,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerClick, ref onPointerClicks, cancellationToken); } @@ -155,7 +155,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onSubmit, ref onSubmits, cancellationToken); } @@ -167,7 +167,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onDrag, ref onDrags, cancellationToken); } @@ -179,7 +179,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onBeginDrag, ref onBeginDrags, cancellationToken); } @@ -191,7 +191,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onEndDrag, ref onEndDrags, cancellationToken); } @@ -203,7 +203,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnDropAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnDropAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onDrop, ref onDrops, cancellationToken); } @@ -215,7 +215,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onUpdateSelected, ref onUpdateSelecteds, cancellationToken); } @@ -227,7 +227,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onInitializePotentialDrag, ref onInitializePotentialDrags, cancellationToken); } @@ -239,7 +239,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onCancel, ref onCancels, cancellationToken); } @@ -251,7 +251,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncInitializePotentialDragTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncInitializePotentialDragTrigger.cs index 59e04b4..4334b4e 100644 --- a/Assets/UniRx.Async/Triggers/AsyncInitializePotentialDragTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncInitializePotentialDragTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onInitializePotentialDrag, ref onInitializePotentialDrags, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncJointTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncJointTrigger.cs index 9321182..bf33407 100644 --- a/Assets/UniRx.Async/Triggers/AsyncJointTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncJointTrigger.cs @@ -30,7 +30,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnJointBreakAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnJointBreakAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onJointBreak, ref onJointBreaks, cancellationToken); } @@ -42,7 +42,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnJointBreak2DAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnJointBreak2DAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onJointBreak2D, ref onJointBreak2Ds, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncMoveTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncMoveTrigger.cs index cab098c..6066c8d 100644 --- a/Assets/UniRx.Async/Triggers/AsyncMoveTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncMoveTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onMove, ref onMoves, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncParticleTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncParticleTrigger.cs index 4e22b36..284461a 100644 --- a/Assets/UniRx.Async/Triggers/AsyncParticleTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncParticleTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnParticleCollisionAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnParticleCollisionAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onParticleCollision, ref onParticleCollisions, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncPointerClickTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncPointerClickTrigger.cs index 64b902d..5a9167a 100644 --- a/Assets/UniRx.Async/Triggers/AsyncPointerClickTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncPointerClickTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerClick, ref onPointerClicks, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncPointerDownTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncPointerDownTrigger.cs index 2e32bfc..12cb568 100644 --- a/Assets/UniRx.Async/Triggers/AsyncPointerDownTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncPointerDownTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerDown, ref onPointerDowns, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncPointerEnterTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncPointerEnterTrigger.cs index 36ed2e3..2532079 100644 --- a/Assets/UniRx.Async/Triggers/AsyncPointerEnterTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncPointerEnterTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerEnter, ref onPointerEnters, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncPointerExitTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncPointerExitTrigger.cs index 3cf2575..29063d4 100644 --- a/Assets/UniRx.Async/Triggers/AsyncPointerExitTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncPointerExitTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerExit, ref onPointerExits, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncPointerUpTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncPointerUpTrigger.cs index 4f56fa9..1eb0b92 100644 --- a/Assets/UniRx.Async/Triggers/AsyncPointerUpTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncPointerUpTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onPointerUp, ref onPointerUps, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncScrollTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncScrollTrigger.cs index 7a28c64..363a25a 100644 --- a/Assets/UniRx.Async/Triggers/AsyncScrollTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncScrollTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncSelectTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncSelectTrigger.cs index 093ec79..1a98f9d 100644 --- a/Assets/UniRx.Async/Triggers/AsyncSelectTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncSelectTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onSelect, ref onSelects, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncSubmitTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncSubmitTrigger.cs index 0dd4206..ff9b17d 100644 --- a/Assets/UniRx.Async/Triggers/AsyncSubmitTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncSubmitTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onSubmit, ref onSubmits, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncTrigger2DTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncTrigger2DTrigger.cs index dc33415..fb3cfe5 100644 --- a/Assets/UniRx.Async/Triggers/AsyncTrigger2DTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncTrigger2DTrigger.cs @@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnTriggerEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnTriggerEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onTriggerEnter2D, ref onTriggerEnter2Ds, cancellationToken); } @@ -44,7 +44,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnTriggerExit2DAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnTriggerExit2DAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onTriggerExit2D, ref onTriggerExit2Ds, cancellationToken); } @@ -56,7 +56,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnTriggerStay2DAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnTriggerStay2DAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onTriggerStay2D, ref onTriggerStay2Ds, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncTriggerTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncTriggerTrigger.cs index 22f3c94..8ee5d62 100644 --- a/Assets/UniRx.Async/Triggers/AsyncTriggerTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncTriggerTrigger.cs @@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnTriggerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnTriggerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onTriggerEnter, ref onTriggerEnters, cancellationToken); } @@ -44,7 +44,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnTriggerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnTriggerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onTriggerExit, ref onTriggerExits, cancellationToken); } @@ -56,7 +56,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnTriggerStayAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnTriggerStayAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onTriggerStay, ref onTriggerStays, cancellationToken); } diff --git a/Assets/UniRx.Async/Triggers/AsyncUpdateSelectedTrigger.cs b/Assets/UniRx.Async/Triggers/AsyncUpdateSelectedTrigger.cs index 5f7536e..fcb81f6 100644 --- a/Assets/UniRx.Async/Triggers/AsyncUpdateSelectedTrigger.cs +++ b/Assets/UniRx.Async/Triggers/AsyncUpdateSelectedTrigger.cs @@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers } - public UniTask OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken)) + public UniTask OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken)) { return GetOrAddPromise(ref onUpdateSelected, ref onUpdateSelecteds, cancellationToken); } diff --git a/Assets/UniRx.Async/UnityAsyncExtensions.cs b/Assets/UniRx.Async/UnityAsyncExtensions.cs index 0005ca7..7d7f0a8 100644 --- a/Assets/UniRx.Async/UnityAsyncExtensions.cs +++ b/Assets/UniRx.Async/UnityAsyncExtensions.cs @@ -168,13 +168,16 @@ namespace UniRx.Async } } - asyncOperation = null; // remove reference. - if (continuationAction != null) { asyncOperation.completed -= continuationAction; + asyncOperation = null; // remove reference. continuationAction = null; } + else + { + asyncOperation = null; // remove reference. + } } public void OnCompleted(Action continuation) @@ -316,13 +319,17 @@ namespace UniRx.Async } this.result = asyncOperation.asset; - asyncOperation = null; // remove reference. if (continuationAction != null) { asyncOperation.completed -= continuationAction; + asyncOperation = null; // remove reference. continuationAction = null; } + else + { + asyncOperation = null; // remove reference. + } return this.result; } @@ -576,13 +583,18 @@ namespace UniRx.Async } this.result = asyncOperation.webRequest; - asyncOperation = null; // remove reference. if (continuationAction != null) { asyncOperation.completed -= continuationAction; + asyncOperation = null; // remove reference. continuationAction = null; } + else + { + asyncOperation = null; // remove reference. + } + return this.result; } diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset index 71e5981..6c5cf8a 100644 Binary files a/ProjectSettings/Physics2DSettings.asset and b/ProjectSettings/Physics2DSettings.asset differ