高亮bug

This commit is contained in:
Afeijia 2023-08-30 17:16:38 +08:00
parent 8626552a2e
commit cb2634dc76
1 changed files with 19 additions and 5 deletions

View File

@ -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("<b>[SteamVR Interaction]</b> 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("<b>[SteamVR Interaction]</b> 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()