高亮bug
This commit is contained in:
parent
8626552a2e
commit
cb2634dc76
|
@ -10,6 +10,8 @@ public class HighLight_VR : MonoBehaviour
|
||||||
[ContextMenu("Highlight")]
|
[ContextMenu("Highlight")]
|
||||||
public void Highlight()
|
public void Highlight()
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
wasHovering = isHovering;
|
wasHovering = isHovering;
|
||||||
isHovering = true;
|
isHovering = true;
|
||||||
|
|
||||||
|
@ -69,20 +71,32 @@ public class HighLight_VR : MonoBehaviour
|
||||||
}
|
}
|
||||||
protected virtual bool ShouldIgnore(GameObject check)
|
protected virtual bool ShouldIgnore(GameObject check)
|
||||||
{
|
{
|
||||||
|
if (hideHighlight == null) return false;
|
||||||
for (int ignoreIndex = 0; ignoreIndex < hideHighlight.Length; ignoreIndex++)
|
for (int ignoreIndex = 0; ignoreIndex < hideHighlight.Length; ignoreIndex++)
|
||||||
{
|
{
|
||||||
if (check == hideHighlight[ignoreIndex])
|
if (hideHighlight != null && check == hideHighlight[ignoreIndex])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
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()
|
protected virtual void Start()
|
||||||
{
|
{
|
||||||
highlightMat = (Material)Resources.Load("SteamVR_HoverHighlight", typeof(Material));
|
Init();
|
||||||
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 CreateHighlightRenderers()
|
protected virtual void CreateHighlightRenderers()
|
||||||
|
|
Loading…
Reference in New Issue