From 0069ad9afe1b27fde06be29308866539a188ca27 Mon Sep 17 00:00:00 2001 From: z3y <33181641+z3y@users.noreply.github.com> Date: Tue, 2 May 2023 23:06:06 +0200 Subject: [PATCH 1/2] fix writing after disabled --- Runtime/Scripts/MarkerSync.cs | 4 ++-- Runtime/Scripts/MarkerTrail.cs | 14 +++++++++----- Tests/Marker.unity | 21 ++++----------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/Runtime/Scripts/MarkerSync.cs b/Runtime/Scripts/MarkerSync.cs index be2b718..b0075d1 100644 --- a/Runtime/Scripts/MarkerSync.cs +++ b/Runtime/Scripts/MarkerSync.cs @@ -30,13 +30,13 @@ public override void OnDeserialization() if (markerTrail.enabled) { markerTrail.StopWriting(); - markerTrail.AddEndCap(); + //markerTrail.AddEndCap(); } markerTrail.StartWriting(); break; case 1: // stop writing without sync markerTrail.StopWriting(); - markerTrail.AddEndCap(); + //markerTrail.AddEndCap(); markerTrail.UpdateUsedVertices(); markerTrail.RecalculateMeshBounds(); break; diff --git a/Runtime/Scripts/MarkerTrail.cs b/Runtime/Scripts/MarkerTrail.cs index c775d56..06a3cab 100644 --- a/Runtime/Scripts/MarkerTrail.cs +++ b/Runtime/Scripts/MarkerTrail.cs @@ -104,8 +104,12 @@ public void SetGradient(MaterialPropertyBlock pb) private void Update() { - _time += Time.deltaTime; + if (!enabled) // can end up running for a frame breaking things + { + return; + } + _time += Time.deltaTime; _smoothingPosition = Vector3.Lerp(trailPosition.position, _previousSmoothingPosition, _smoothingCached); _previousSmoothingPosition = _smoothingPosition; @@ -113,7 +117,7 @@ private void Update() UpdateLastPosition(_smoothingPosition, _previousPosition); UpdateMeshData(); - if (_time <= updateRate || Vector3.Distance(_smoothingPosition, _previousPosition) < minDistance || !enabled) + if (_time <= updateRate || Vector3.Distance(_smoothingPosition, _previousPosition) < minDistance) { return; } @@ -164,18 +168,18 @@ public void StopWriting() if (isLocal && GetSyncLines().Length > 1) { - AddEndCap(); + //AddEndCap(); StoreLastLinesTransform(_smoothingPosition); RecalculateMeshBounds(); } } - public void AddEndCap() + /* public void AddEndCap() { CreateTrailLine(_previousPosition, _smoothingPosition); //CreateTrailLine(_smoothingPosition, _previousPosition); // mot needed anymore UpdateMeshData(); - } + }*/ diff --git a/Tests/Marker.unity b/Tests/Marker.unity index e0ce8f0..81ec2e6 100644 --- a/Tests/Marker.unity +++ b/Tests/Marker.unity @@ -1035,22 +1035,22 @@ PrefabInstance: type: 3} propertyPath: DynamicMaterials.Array.data[0] value: - objectReference: {fileID: 2100000, guid: c140e04943058f14595009983640dc93, type: 2} + objectReference: {fileID: 2100000, guid: 7948a8a92ff13ba4eb2325ddc8339b74, type: 2} - target: {fileID: 6759095419728963412, guid: 8894fa7e4588a5c4fab98453e558847d, type: 3} propertyPath: DynamicMaterials.Array.data[1] value: - objectReference: {fileID: 2100000, guid: 7948a8a92ff13ba4eb2325ddc8339b74, type: 2} + objectReference: {fileID: 2100000, guid: c140e04943058f14595009983640dc93, type: 2} - target: {fileID: 6759095419728963412, guid: 8894fa7e4588a5c4fab98453e558847d, type: 3} propertyPath: DynamicMaterials.Array.data[2] value: - objectReference: {fileID: 2100000, guid: dfff2cc7941433f4d82fa7cbca153b76, type: 2} + objectReference: {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - target: {fileID: 6759095419728963412, guid: 8894fa7e4588a5c4fab98453e558847d, type: 3} propertyPath: DynamicMaterials.Array.data[3] value: - objectReference: {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + objectReference: {fileID: 2100000, guid: dfff2cc7941433f4d82fa7cbca153b76, type: 2} - target: {fileID: 6759095419728963412, guid: 8894fa7e4588a5c4fab98453e558847d, type: 3} propertyPath: DynamicMaterials.Array.data[4] @@ -10241,19 +10241,6 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 74486861} m_PrefabAsset: {fileID: 0} ---- !u!114 &1718247551 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1718247546} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 229740497, guid: 4ecd63eff847044b68db9453ce219299, type: 3} - m_Name: - m_EditorClassIdentifier: - contentType: 1 --- !u!1 &1734195320 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6357700640741054161, guid: d623141a231a48e43b02346883eea70d, From a877cbbe9609d4cb18d4151f6ac2e1aae44ab5c1 Mon Sep 17 00:00:00 2001 From: z3y <33181641+z3y@users.noreply.github.com> Date: Tue, 2 May 2023 23:15:32 +0200 Subject: [PATCH 2/2] add input field for url --- Tests/Marker.unity | 319 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 315 insertions(+), 4 deletions(-) diff --git a/Tests/Marker.unity b/Tests/Marker.unity index 81ec2e6..c69e010 100644 --- a/Tests/Marker.unity +++ b/Tests/Marker.unity @@ -3756,7 +3756,8 @@ GameObject: - component: {fileID: 440833315} - component: {fileID: 440833314} - component: {fileID: 440833313} - m_Layer: 5 + - component: {fileID: 440833317} + m_Layer: 0 m_Name: Canvas m_TagString: Untagged m_Icon: {fileID: 0} @@ -3837,6 +3838,7 @@ RectTransform: - {fileID: 548224164} - {fileID: 1070976278} - {fileID: 358063559} + - {fileID: 1950578354} m_Father: {fileID: 0} m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3845,6 +3847,18 @@ RectTransform: m_AnchoredPosition: {x: 0.116, y: 1.108} m_SizeDelta: {x: 500, y: 500} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &440833317 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 440833312} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -1533785930, guid: 661092b4961be7145bfbe56e1e62337b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &449002593 GameObject: m_ObjectHideFlags: 0 @@ -3990,13 +4004,13 @@ GameObject: - component: {fileID: 548224164} - component: {fileID: 548224166} - component: {fileID: 548224165} - m_Layer: 5 + m_Layer: 0 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &548224164 RectTransform: m_ObjectHideFlags: 0 @@ -8214,7 +8228,7 @@ GameObject: - component: {fileID: 1070976278} - component: {fileID: 1070976280} - component: {fileID: 1070976279} - m_Layer: 5 + m_Layer: 0 m_Name: Text (1) m_TagString: Untagged m_Icon: {fileID: 0} @@ -9107,6 +9121,84 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 632286867} m_PrefabAsset: {fileID: 0} +--- !u!1 &1375628682 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1375628683} + - component: {fileID: 1375628685} + - component: {fileID: 1375628684} + m_Layer: 0 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1375628683 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1375628682} + 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: 1950578354} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -2.899994, y: -10.8} + m_SizeDelta: {x: -20, y: 5.397312} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1375628684 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1375628682} + 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: 17 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: github.com/z3y/VRCMarker +--- !u!222 &1375628685 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1375628682} + m_CullTransparentMesh: 0 --- !u!1 &1384860838 stripped GameObject: m_CorrespondingSourceObject: {fileID: 2032845121056251825, guid: d623141a231a48e43b02346883eea70d, @@ -9417,6 +9509,84 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 581782799} m_PrefabAsset: {fileID: 0} +--- !u!1 &1518858711 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1518858712} + - component: {fileID: 1518858714} + - component: {fileID: 1518858713} + m_Layer: 0 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1518858712 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1518858711} + 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: 1950578354} + 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.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1518858713 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1518858711} + m_Enabled: 0 + 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: 17 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: github.com/z3y/VRCMarker +--- !u!222 &1518858714 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1518858711} + m_CullTransparentMesh: 0 --- !u!1 &1528138159 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6357700640741054161, guid: d623141a231a48e43b02346883eea70d, @@ -10361,6 +10531,147 @@ MonoBehaviour: m_Script: {fileID: -1783056023, guid: 661092b4961be7145bfbe56e1e62337b, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &1950578353 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1950578354} + - component: {fileID: 1950578357} + - component: {fileID: 1950578356} + - component: {fileID: 1950578355} + m_Layer: 0 + m_Name: InputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1950578354 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950578353} + 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: 1518858712} + - {fileID: 1375628683} + m_Father: {fileID: 440833316} + m_RootOrder: 3 + 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: -110.4, y: -241.4} + m_SizeDelta: {x: 265.78787, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1950578355 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950578353} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, 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: 1950578356} + m_TextComponent: {fileID: 1375628684} + m_Placeholder: {fileID: 1518858713} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: github.com/z3y/VRCMarker + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_ShouldActivateOnSelect: 1 +--- !u!114 &1950578356 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950578353} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 10911, 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 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1950578357 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950578353} + m_CullTransparentMesh: 0 --- !u!1001 &1952057908 PrefabInstance: m_ObjectHideFlags: 0