If you need more precision for the Audio Listener

If you have a different camera setting and need more precision for audio listener location, I made a simple script that can help you with that. Add it to the child gameobject that Sam built.

    [SerializeField] string playerTag = "Player";
    [SerializeField] float offset = 2f;
    [SerializeField] float lazySeconds = 2f;

    GameObject player;

    void Start()
    {
        player = GameObject.FindWithTag(playerTag);
        if(player != null) StartCoroutine(LazyStart());
    }

    private IEnumerator LazyStart()
    {
        yield return new WaitForSeconds(lazySeconds);
        transform.position = player.transform.position + new Vector3(0f, offset, 0f);
    }

The Lazy Start is in case you have some setup during the Fade.
Don’t forget to adjust the player tag name.

If you want, you can add a Method that relocates the camera for a special scene where the camera moves away from the player, like a cinematic for example.

2 Likes

Very handy!

1 Like

Privacy & Terms