From 14b5c9ffa9d3faf6e2ab49ef2cc27b18475ce1e8 Mon Sep 17 00:00:00 2001 From: guillemsunyer-omnidrone Date: Tue, 17 Nov 2020 18:22:07 +0100 Subject: [PATCH] Null feedbacks --- Editor/Feedbacks/FeedbacksPlayerCE.cs | 12 +- Examples/Example5/Example5.unity | 361 ++++++++++++++++++++++++-- 2 files changed, 344 insertions(+), 29 deletions(-) diff --git a/Editor/Feedbacks/FeedbacksPlayerCE.cs b/Editor/Feedbacks/FeedbacksPlayerCE.cs index b35c267..a356cc5 100644 --- a/Editor/Feedbacks/FeedbacksPlayerCE.cs +++ b/Editor/Feedbacks/FeedbacksPlayerCE.cs @@ -80,6 +80,11 @@ private void DrawFeedbacksSection() { Feedback currFeedback = feedbacksProperty.GetArrayElementAtIndex(i).objectReferenceValue as Feedback; + if (currFeedback == null) + { + continue; + } + FeedbackEditorData feedbackEditorData = GetOrCreateFeedbackeEditor(currFeedback); DrawFeedback(feedbackEditorData, i, e); @@ -584,7 +589,7 @@ private void TryRepareFeedbacks() { Debug.LogError($"{nameof(Feedback)} is null and could not be repared"); - RemoveFeedback(currFeedback); + continue; } bool needsToBeRecreated = currFeedback.gameObject == null; @@ -630,6 +635,11 @@ private FeedbackEditorData GetOrCreateFeedbackeEditor(Feedback feedback) private void RemoveFeedbackEditor(Feedback feedback) { + if (feedback == null) + { + return; + } + cachedEditorFeedback.Remove(feedback); } diff --git a/Examples/Example5/Example5.unity b/Examples/Example5/Example5.unity index 6af963f..e99eb18 100644 --- a/Examples/Example5/Example5.unity +++ b/Examples/Example5/Example5.unity @@ -161,13 +161,13 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: feedbacks: - - {fileID: 0} + - {fileID: 218086459} - {fileID: 218086458} - {fileID: 218086457} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} + - {fileID: 218086456} + - {fileID: 218086455} + - {fileID: 218086454} + - {fileID: 218086453} - {fileID: 218086452} - {fileID: 218086451} - {fileID: 218086450} @@ -192,7 +192,7 @@ Transform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &218086450 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -211,7 +211,7 @@ MonoBehaviour: delay: 1 --- !u!114 &218086451 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -273,7 +273,7 @@ MonoBehaviour: loops: 0 --- !u!114 &218086452 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -292,7 +292,7 @@ MonoBehaviour: delay: 0 --- !u!114 &218086453 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -302,9 +302,41 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 403caac0594bfdb4486ea1708dabf1d8, type: 3} m_Name: (Clone) m_EditorClassIdentifier: + expanded: 0 + disabled: 0 + userData: + scriptUsage: + usedByScript: 0 + idUsedByScript: + target: {fileID: 1975861896} + value: + useStartValue: 0 + useStartColor: 0 + useStartAlpha: 1 + useEndColor: 0 + useEndAlpha: 1 + startColor: {r: 1, g: 1, b: 1, a: 1} + startAlpha: 0 + endColor: {r: 1, g: 1, b: 1, a: 1} + endAlpha: 1 + delay: 0.8 + duration: 0.6 + easing: + useAnimationCurve: 0 + easing: 6 + animationCurveEasing: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + looping: + loopMode: 0 + loopResetMode: 0 + loops: 0 --- !u!114 &218086454 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -314,9 +346,53 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d90f51f8a8b1d364caee7ca16de769ea, type: 3} m_Name: m_EditorClassIdentifier: + expanded: 0 + disabled: 0 + userData: + scriptUsage: + usedByScript: 0 + idUsedByScript: + target: {fileID: 2050782985} + value: + useStartValue: 0 + startValue: 0 + endValue: 0 + delay: 0.4 + duration: 0.5 + easing: + useAnimationCurve: 0 + easing: 6 + animationCurveEasing: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.0017089844 + inSlope: -0.85931987 + outSlope: -0.85931987 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0.11968085 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1.001709 + outSlope: 1.001709 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + looping: + loopMode: 0 + loopResetMode: 0 + loops: 0 --- !u!114 &218086455 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -326,9 +402,35 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1f0a16a27725209479bf8e531ed140ef, type: 3} m_Name: m_EditorClassIdentifier: + expanded: 0 + disabled: 0 + userData: + scriptUsage: + usedByScript: 0 + idUsedByScript: + target: {fileID: 1459270372} + value: + useStartValue: 0 + startValue: 0 + endValue: 0 + delay: 0.2 + duration: 1.3 + easing: + useAnimationCurve: 0 + easing: 18 + animationCurveEasing: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + looping: + loopMode: 0 + loopResetMode: 0 + loops: 0 --- !u!114 &218086456 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -338,9 +440,35 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9777556f99dfab54cadac4c10a4a2503, type: 3} m_Name: m_EditorClassIdentifier: + expanded: 0 + disabled: 0 + userData: + scriptUsage: + usedByScript: 0 + idUsedByScript: + target: {fileID: 313110525} + value: + useStartValue: 0 + startValue: 0 + endValue: 0 + delay: 0 + duration: 1.3 + easing: + useAnimationCurve: 0 + easing: 18 + animationCurveEasing: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + looping: + loopMode: 0 + loopResetMode: 0 + loops: 0 --- !u!114 &218086457 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -359,7 +487,7 @@ MonoBehaviour: delay: 0 --- !u!114 &218086458 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -430,7 +558,7 @@ MonoBehaviour: loops: 0 --- !u!114 &218086459 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -440,6 +568,38 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 403caac0594bfdb4486ea1708dabf1d8, type: 3} m_Name: m_EditorClassIdentifier: + expanded: 0 + disabled: 0 + userData: + scriptUsage: + usedByScript: 0 + idUsedByScript: + target: {fileID: 1975861896} + value: + useStartValue: 1 + useStartColor: 0 + useStartAlpha: 1 + useEndColor: 0 + useEndAlpha: 0 + startColor: {r: 1, g: 1, b: 1, a: 1} + startAlpha: 0 + endColor: {r: 1, g: 1, b: 1, a: 1} + endAlpha: 0 + delay: 0 + duration: 1 + easing: + useAnimationCurve: 0 + easing: 6 + animationCurveEasing: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + looping: + loopMode: 0 + loopResetMode: 0 + loops: 0 --- !u!1 &313110523 GameObject: m_ObjectHideFlags: 0 @@ -452,7 +612,7 @@ GameObject: - component: {fileID: 313110526} - component: {fileID: 313110525} m_Layer: 5 - m_Name: Title + m_Name: TitleText m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -524,8 +684,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 26.7 - m_fontSizeBase: 26.7 + m_fontSize: 36 + m_fontSizeBase: 36 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -665,6 +825,7 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 1490509801} + - {fileID: 781015623} m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -712,6 +873,85 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &781015622 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 781015623} + - component: {fileID: 781015625} + - component: {fileID: 781015624} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &781015623 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 781015622} + 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: 492167684} + 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: 22.4, y: 266} + m_SizeDelta: {x: 886.72876, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &781015624 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 781015622} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 21 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: This example uses TextMeshPro Extension, and it wont work if not added + to the project +--- !u!222 &781015625 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 781015622} + m_CullTransparentMesh: 0 --- !u!1 &1459270370 GameObject: m_ObjectHideFlags: 0 @@ -797,8 +1037,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 19.2 - m_fontSizeBase: 19.2 + m_fontSize: 18.6 + m_fontSizeBase: 18.6 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -970,7 +1210,7 @@ RectTransform: 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: 1.3952, y: -301} + m_AnchoredPosition: {x: 1.3952, y: -328} m_SizeDelta: {x: 295.50165, y: 192.20146} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1975861896 @@ -992,9 +1232,8 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi - ut aliquip ex ea commodo consequat. Ut enim ad minim veniam, quis nostrud exercitation - ullamco + m_text: 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi + ut aliquip ex ea commodo consequat. Ut enim ad minim veniam, quis nostrud exercitation ' m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: fd7310cb0736dce41819e635c2015c8d, type: 2} m_sharedMaterial: {fileID: -3428388608265096833, guid: fd7310cb0736dce41819e635c2015c8d, @@ -1022,8 +1261,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 19.2 - m_fontSizeBase: 19.2 + m_fontSize: 18.6 + m_fontSizeBase: 18.6 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -1155,6 +1394,72 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2014631778 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2014631781} + - component: {fileID: 2014631780} + - component: {fileID: 2014631779} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2014631779 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2014631778} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, 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 &2014631780 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2014631778} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &2014631781 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2014631778} + 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: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2050782983 GameObject: m_ObjectHideFlags: 0 @@ -1239,8 +1544,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 19.2 - m_fontSizeBase: 19.2 + m_fontSize: 19.5 + m_fontSizeBase: 19.5 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18