//------------------------------------------------- private void ShowButtonHint(params SteamVR_Action_In[] actions) { renderModel.gameObject.SetActive(true); renderModel.GetComponentsInChildren <MeshRenderer>(renderers); for (var i = 0; i < renderers.Count; i++) { var mainTexture = renderers[i].material.mainTexture; renderers[i].sharedMaterial = controllerMaterial; renderers[i].material.mainTexture = mainTexture; // This is to poke unity into setting the correct render queue for the model renderers[i].material.renderQueue = controllerMaterial.shader.renderQueue; } for (var i = 0; i < actions.Length; i++) { if (actionHintInfos.ContainsKey(actions[i])) { var hintInfo = actionHintInfos[actions[i]]; foreach (var renderer in hintInfo.renderers) { if (!flashingRenderers.Contains(renderer)) { flashingRenderers.Add(renderer); } } } } startTime = Time.realtimeSinceStartup; tickCount = 0.0f; }
public void Show(params Valve.VR.EVRButtonId[] buttons) { Clear(); renderModel.gameObject.SetActive(true); renderModel.GetComponentsInChildren <MeshRenderer>(renderers); for (int i = 0; i < renderers.Count; i++) { Texture mainTexture = renderers[i].material.mainTexture; renderers[i].sharedMaterial = controllerMaterial; renderers[i].material.mainTexture = mainTexture; // This is to poke unity into setting the correct render queue for the model renderers[i].material.renderQueue = controllerMaterial.shader.renderQueue; } for (int i = 0; i < buttons.Length; i++) { switch (buttons[i]) { case Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger: FlashRenderers("trigger"); break; case Valve.VR.EVRButtonId.k_EButton_ApplicationMenu: FlashRenderers("button"); break; case Valve.VR.EVRButtonId.k_EButton_System: FlashRenderers("sys_button"); break; case Valve.VR.EVRButtonId.k_EButton_Grip: FlashRenderers("lgrip"); FlashRenderers("rgrip"); break; case Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad: FlashRenderers("trackpad"); break; } } startTime = Time.realtimeSinceStartup; tickCount = 0.0f; }