diff --git a/GQ_TongXin/Assets/Materials/HighLight_VR.cs b/GQ_TongXin/Assets/Materials/HighLight_VR.cs
index ededb4518..9d723d4ba 100644
--- a/GQ_TongXin/Assets/Materials/HighLight_VR.cs
+++ b/GQ_TongXin/Assets/Materials/HighLight_VR.cs
@@ -10,6 +10,8 @@ public class HighLight_VR : MonoBehaviour
[ContextMenu("Highlight")]
public void Highlight()
{
+ Init();
+
wasHovering = isHovering;
isHovering = true;
@@ -69,20 +71,32 @@ public class HighLight_VR : MonoBehaviour
}
protected virtual bool ShouldIgnore(GameObject check)
{
+ if (hideHighlight == null) return false;
for (int ignoreIndex = 0; ignoreIndex < hideHighlight.Length; ignoreIndex++)
{
- if (check == hideHighlight[ignoreIndex])
+ if (hideHighlight != null && check == hideHighlight[ignoreIndex])
return true;
}
return false;
}
+ bool inited = false;
+
+ private void Init()
+ {
+ if (!inited)
+ {
+ inited = true;
+ highlightMat = (Material)Resources.Load("SteamVR_HoverHighlight", typeof(Material));
+ if (highlightMat == null)
+ Debug.LogError("[SteamVR Interaction] Hover Highlight Material is missing. Please create a material named 'SteamVR_HoverHighlight' and place it in a Resources folder", this);
+
+ }
+ }
+
protected virtual void Start()
{
- highlightMat = (Material)Resources.Load("SteamVR_HoverHighlight", typeof(Material));
- if (highlightMat == null)
- Debug.LogError("[SteamVR Interaction] Hover Highlight Material is missing. Please create a material named 'SteamVR_HoverHighlight' and place it in a Resources folder", this);
-
+ Init();
}
protected virtual void CreateHighlightRenderers()