- Home /
playing audio with the GoogleVR Reticle Script
Hello
v 2017 is messing up my scripts, Not that they were great to start ; )
I am using the GoogleVR reticle script to instead of teleporting to play audio... and I'm not even able to write to the console though I'm picking the correct triggers and they are showing up in the inspector...
Modded script for Audio : using System.Collections; using System.Collections.Generic; using UnityEngine;
[RequireComponent(typeof(Collider))]
[RequireComponent(typeof(AudioSource))]
public class reticleAudio : MonoBehaviour
{
private Vector3 startingPosition;
public Material inactiveMaterial;
public Material gazedAtMaterial;
void Start()
{
startingPosition = transform.localPosition;
SetGazedAt(false);
AudioSource audio = GetComponent<AudioSource>();
}
public void SetGazedAt(bool gazedAt)
{
if (inactiveMaterial != null && gazedAtMaterial != null)
{
GetComponent<Renderer>().material = gazedAt ? gazedAtMaterial : inactiveMaterial;
return;
}
GetComponent<Renderer>().material.color = gazedAt ? Color.green : Color.red;
}
public void Reset()
{
transform.localPosition = startingPosition;
}
public void Recenter()
{
#if !UNITY_EDITOR
GvrCardboardHelpers.Recenter();
#else
GvrEditorEmulator emulator = FindObjectOfType<GvrEditorEmulator>();
if (emulator == null)
{
return;
}
emulator.Recenter();
#endif // !UNITY_EDITOR
}
public void playAudio()
{
// audio.Play();
Debug.Log("AUDIO");
}
public void OnMouseUp()
{
// audio.Play();
Debug.Log("AUDIO");
}
}
Comment
Your answer
Follow this Question
Related Questions
[Daydream] Disable default volume menu? 0 Answers
GUIText and Raycasting with google cardboard 0 Answers
Google VR Audio does not work on iOS 0 Answers
Cardboard SDK secretly changing FOV? 0 Answers
VR Standard Assets Reticle Layers? 0 Answers