Brook Mesfin
Brook Mesfin

Reputation: 41

How do I use SteamVR_LoadLevel to fade between scenes in unity3d?

I've got this at the top,

    public GameObject mainCamera

and then I've got this within an if statement,

    SteamVR_LoadLevel tempload = mainCamera.GetComponent<SteamVR_LoadLevel>();
    tempload.fadeOutTime = 1f;
    tempload.fadeInTime = 1f;
    tempload.Trigger();

but I'm getting this error when triggering the if statement,

Coroutine 'LoadLevel' couldn't be started because the the game object 'Camera (head)' is inactive!

Edit 1. I figured it out, I should have made the mainCamera variable of type SteamVR_Camera and I should have nullchecked it as well as tested for it being active and enabled.

Upvotes: 0

Views: 1788

Answers (1)

OnionFan
OnionFan

Reputation: 511

Check state game object "Camera (head)" in hierarchy window and active him

Upvotes: 1

Related Questions