Skip to content

Commit c12e037

Browse files
Sample Null Ref Check (#122)
1 parent dc3d081 commit c12e037

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

com.microsoft.mrtk.graphicstools.unity/Samples~/UnityUI/Scripts/ScriptedMaterialAnimation.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,21 @@ public class ScriptedMaterialAnimation : MonoBehaviour
1212
{
1313
public CanvasMaterialAnimatorGraphicsToolsStandardCanvas Animator;
1414

15+
private void Start()
16+
{
17+
if (Animator == null)
18+
{
19+
Animator = GetComponent<CanvasMaterialAnimatorGraphicsToolsStandardCanvas>();
20+
}
21+
}
22+
1523
private void Update()
1624
{
17-
Animator._VertexExtrusionValue = Mathf.Lerp(0, 0.002f, (Mathf.Sin(Mathf.Repeat(Time.time, Mathf.PI * 2.0f)) + 1.0f) * 0.5f);
18-
Animator.ApplyToMaterial();
25+
if (Animator != null)
26+
{
27+
Animator._VertexExtrusionValue = Mathf.Lerp(0, 0.002f, (Mathf.Sin(Mathf.Repeat(Time.time, Mathf.PI * 2.0f)) + 1.0f) * 0.5f);
28+
Animator.ApplyToMaterial();
29+
}
1930
}
2031
}
2132
}

com.microsoft.mrtk.graphicstools.unity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.microsoft.mrtk.graphicstools.unity",
3-
"version": "0.4.15",
3+
"version": "0.4.16",
44
"displayName": "MRTK Graphics Tools",
55
"description": "Graphics tools and components for developing Mixed Reality applications in Unity.",
66
"msftFeatureCategory": "MRTK3",

0 commit comments

Comments
 (0)