master
neuecc 2019-05-30 19:41:23 +09:00
parent fbe6746850
commit 642cbe6bcd
31 changed files with 765 additions and 66 deletions

View File

@ -1,20 +1,33 @@
using System.Collections; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
using UniRx.Async; using UniRx.Async;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class SandboxMain : MonoBehaviour public class SandboxMain : MonoBehaviour
{ {
// Start is called before the first frame update public Button okButton;
void Start() public Button cancelButton;
{ CancellationTokenSource cts;
RunAsync().Forget();
}
async UniTaskVoid RunAsync() async void Start()
{ {
var id = await UniTask.Run(() => System.Threading.Thread.CurrentThread.ManagedThreadId, configureAwait: false); await UniTask.CompletedTask; // ok
UnityEngine.Debug.Log("ReturnId:" + id);
UnityEngine.Debug.Log("CurrentId:" + System.Threading.Thread.CurrentThread.ManagedThreadId); // var subject = new Subject<Unit>();
//subject.OnCompleted();
IObservable<AsyncUnit> subject = default;
try
{
await subject.ToUniTask(); // exception
}
catch (Exception exception)
{
Debug.Log(exception);
}
} }
} }

View File

@ -120,6 +120,127 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 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 --- !u!1 &519420028
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -159,6 +280,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f0bc6c75abb2e0b47a25aa49bfd488ed, type: 3} m_Script: {fileID: 11500000, guid: f0bc6c75abb2e0b47a25aa49bfd488ed, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
okButton: {fileID: 16537672}
cancelButton: {fileID: 628393011}
--- !u!20 &519420031 --- !u!20 &519420031
Camera: Camera:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -216,3 +339,450 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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

View File

@ -4,7 +4,7 @@
namespace System.Runtime.CompilerServices namespace System.Runtime.CompilerServices
{ {
public sealed class AsyncMethodBuilderAttribute : Attribute internal sealed class AsyncMethodBuilderAttribute : Attribute
{ {
public Type BuilderType { get; } public Type BuilderType { get; }

View File

@ -3,9 +3,11 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Reflection;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
using System.Threading; using System.Threading;
using UniRx.Async.Internal; using UniRx.Async.Internal;
using UnityEngine;
namespace UniRx.Async namespace UniRx.Async
{ {
@ -57,7 +59,7 @@ namespace UniRx.Async
return; return;
} }
this.innerEnumerator = innerEnumerator; this.innerEnumerator = ConsumeEnumerator(innerEnumerator);
this.status = AwaiterStatus.Pending; this.status = AwaiterStatus.Pending;
this.cancellationToken = cancellationToken; this.cancellationToken = cancellationToken;
this.continuation = null; this.continuation = null;
@ -142,6 +144,108 @@ namespace UniRx.Async
Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation);
this.continuation = 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;
}
}
} }
} }
} }

View File

@ -29,7 +29,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnAnimatorIKAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<int> OnAnimatorIKAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onAnimatorIK, ref onAnimatorIKs, cancellationToken); return GetOrAddPromise(ref onAnimatorIK, ref onAnimatorIKs, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onBeginDrag, ref onBeginDrags, cancellationToken); return GetOrAddPromise(ref onBeginDrag, ref onBeginDrags, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<BaseEventData> OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCancel, ref onCancels, cancellationToken); return GetOrAddPromise(ref onCancel, ref onCancels, cancellationToken);
} }

View File

@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnCollisionEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<Collision2D> OnCollisionEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCollisionEnter2D, ref onCollisionEnter2Ds, 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<Collision2D> OnCollisionExit2DAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCollisionExit2D, ref onCollisionExit2Ds, 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<Collision2D> OnCollisionStay2DAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCollisionStay2D, ref onCollisionStay2Ds, cancellationToken); return GetOrAddPromise(ref onCollisionStay2D, ref onCollisionStay2Ds, cancellationToken);
} }

View File

@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnCollisionEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<Collision> OnCollisionEnterAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCollisionEnter, ref onCollisionEnters, 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<Collision> OnCollisionExitAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCollisionExit, ref onCollisionExits, 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<Collision> OnCollisionStayAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCollisionStay, ref onCollisionStays, cancellationToken); return GetOrAddPromise(ref onCollisionStay, ref onCollisionStays, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<BaseEventData> OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onDeselect, ref onDeselects, cancellationToken); return GetOrAddPromise(ref onDeselect, ref onDeselects, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnDragAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onDrag, ref onDrags, cancellationToken); return GetOrAddPromise(ref onDrag, ref onDrags, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnDropAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnDropAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onDrop, ref onDrops, cancellationToken); return GetOrAddPromise(ref onDrop, ref onDrops, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onEndDrag, ref onEndDrags, cancellationToken); return GetOrAddPromise(ref onEndDrag, ref onEndDrags, cancellationToken);
} }

View File

@ -59,7 +59,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<BaseEventData> OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onDeselect, ref onDeselects, 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<AxisEventData> OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onMove, ref onMoves, 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<PointerEventData> OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerDown, ref onPointerDowns, 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<PointerEventData> OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerEnter, ref onPointerEnters, 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<PointerEventData> OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerExit, ref onPointerExits, 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<PointerEventData> OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerUp, ref onPointerUps, 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<BaseEventData> OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onSelect, ref onSelects, 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<PointerEventData> OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerClick, ref onPointerClicks, 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<BaseEventData> OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onSubmit, ref onSubmits, 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<PointerEventData> OnDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onDrag, ref onDrags, 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<PointerEventData> OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onBeginDrag, ref onBeginDrags, 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<PointerEventData> OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onEndDrag, ref onEndDrags, 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<PointerEventData> OnDropAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onDrop, ref onDrops, 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<BaseEventData> OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onUpdateSelected, ref onUpdateSelecteds, 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<PointerEventData> OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onInitializePotentialDrag, ref onInitializePotentialDrags, 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<BaseEventData> OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onCancel, ref onCancels, 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<PointerEventData> OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken); return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onInitializePotentialDrag, ref onInitializePotentialDrags, cancellationToken); return GetOrAddPromise(ref onInitializePotentialDrag, ref onInitializePotentialDrags, cancellationToken);
} }

View File

@ -30,7 +30,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnJointBreakAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<float> OnJointBreakAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onJointBreak, ref onJointBreaks, 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<Joint2D> OnJointBreak2DAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onJointBreak2D, ref onJointBreak2Ds, cancellationToken); return GetOrAddPromise(ref onJointBreak2D, ref onJointBreak2Ds, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<AxisEventData> OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onMove, ref onMoves, cancellationToken); return GetOrAddPromise(ref onMove, ref onMoves, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnParticleCollisionAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<GameObject> OnParticleCollisionAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onParticleCollision, ref onParticleCollisions, cancellationToken); return GetOrAddPromise(ref onParticleCollision, ref onParticleCollisions, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerClick, ref onPointerClicks, cancellationToken); return GetOrAddPromise(ref onPointerClick, ref onPointerClicks, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerDown, ref onPointerDowns, cancellationToken); return GetOrAddPromise(ref onPointerDown, ref onPointerDowns, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerEnter, ref onPointerEnters, cancellationToken); return GetOrAddPromise(ref onPointerEnter, ref onPointerEnters, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerExit, ref onPointerExits, cancellationToken); return GetOrAddPromise(ref onPointerExit, ref onPointerExits, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onPointerUp, ref onPointerUps, cancellationToken); return GetOrAddPromise(ref onPointerUp, ref onPointerUps, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<PointerEventData> OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken); return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<BaseEventData> OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onSelect, ref onSelects, cancellationToken); return GetOrAddPromise(ref onSelect, ref onSelects, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<BaseEventData> OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onSubmit, ref onSubmits, cancellationToken); return GetOrAddPromise(ref onSubmit, ref onSubmits, cancellationToken);
} }

View File

@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnTriggerEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<Collider2D> OnTriggerEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onTriggerEnter2D, ref onTriggerEnter2Ds, 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<Collider2D> OnTriggerExit2DAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onTriggerExit2D, ref onTriggerExit2Ds, 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<Collider2D> OnTriggerStay2DAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onTriggerStay2D, ref onTriggerStay2Ds, cancellationToken); return GetOrAddPromise(ref onTriggerStay2D, ref onTriggerStay2Ds, cancellationToken);
} }

View File

@ -32,7 +32,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnTriggerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<Collider> OnTriggerEnterAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onTriggerEnter, ref onTriggerEnters, 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<Collider> OnTriggerExitAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onTriggerExit, ref onTriggerExits, 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<Collider> OnTriggerStayAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onTriggerStay, ref onTriggerStays, cancellationToken); return GetOrAddPromise(ref onTriggerStay, ref onTriggerStays, cancellationToken);
} }

View File

@ -28,7 +28,7 @@ namespace UniRx.Async.Triggers
} }
public UniTask OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken)) public UniTask<BaseEventData> OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetOrAddPromise(ref onUpdateSelected, ref onUpdateSelecteds, cancellationToken); return GetOrAddPromise(ref onUpdateSelected, ref onUpdateSelecteds, cancellationToken);
} }

View File

@ -168,13 +168,16 @@ namespace UniRx.Async
} }
} }
asyncOperation = null; // remove reference.
if (continuationAction != null) if (continuationAction != null)
{ {
asyncOperation.completed -= continuationAction; asyncOperation.completed -= continuationAction;
asyncOperation = null; // remove reference.
continuationAction = null; continuationAction = null;
} }
else
{
asyncOperation = null; // remove reference.
}
} }
public void OnCompleted(Action continuation) public void OnCompleted(Action continuation)
@ -316,13 +319,17 @@ namespace UniRx.Async
} }
this.result = asyncOperation.asset; this.result = asyncOperation.asset;
asyncOperation = null; // remove reference.
if (continuationAction != null) if (continuationAction != null)
{ {
asyncOperation.completed -= continuationAction; asyncOperation.completed -= continuationAction;
asyncOperation = null; // remove reference.
continuationAction = null; continuationAction = null;
} }
else
{
asyncOperation = null; // remove reference.
}
return this.result; return this.result;
} }
@ -576,13 +583,18 @@ namespace UniRx.Async
} }
this.result = asyncOperation.webRequest; this.result = asyncOperation.webRequest;
asyncOperation = null; // remove reference.
if (continuationAction != null) if (continuationAction != null)
{ {
asyncOperation.completed -= continuationAction; asyncOperation.completed -= continuationAction;
asyncOperation = null; // remove reference.
continuationAction = null; continuationAction = null;
} }
else
{
asyncOperation = null; // remove reference.
}
return this.result; return this.result;
} }