Search Unity

Virtual camera always in Standby mode, but only in previously created scenes

Discussion in 'Cinemachine' started by KMacro, Apr 23, 2019.

  1. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    I have recently started using Cinemachine in my project, and I'm running into a bit of an issue. When I add a virtual camera to one of my project's scenes, everything seems to be added properly (a Brain is added to my main camera, a new virtual cam object shows up, etc.) but the new virtual camera is permanently set in Standby mode. I've tried disabling and reenabling the virtual camera, creating a new camera in the scene, and changing any and all settings on both the Brain and virtual camera, but the virtual camera seems stuck in Standby mode.

    However, if I create a new scene and add a virtual camera there, everything works fine, and the newly created virtual camera is marked as Live.

    Has something like this happened to anyone else? I supposed I could recreate my scenes to get everything to work, but I would rather avoid having to do that.

    Edit: Using Unity 2018.3.11f1 and Cinemachine 2.2.8
     
    nipunchathuranga45 likes this.
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    One thing to note: the CM brain will only see those vcams that are on layers that pass the Camera's culling mask. Is it possible that your always-standby vcam is on a layer that is filtered out by the Camera's culling mask?
     
  3. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    This was the issue. My main camera does not render the Default layer, which the new vcam was set on. Thank you!
     
    mrboembastic and Gregoryl like this.
  4. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    253
    Would be great, if in label 'Standby' would be written the reason why. Like
    - 'Standby, gameObject inactive'
    - 'Standby, gameObject layer excluded'
     
  5. aplusgreenlawn

    aplusgreenlawn

    Joined:
    Nov 14, 2023
    Posts:
    16
    I am have close to the same issue I am using Virtual camera for a third person Aim with right click. I have my (Player vcam1) and a script to change from (Player vcam1) to (Shoot vcam3) it all seems to work on Right mouse click, the Shoot vcam3 turns on and off during gameplay in the hierarchy, but they won't swap, even with hjigher priority on Shoot vcam3. The camera status just keeps saying Standby. I cant figure it out im new have no idea what (Gregory1) is saying, I tried changing Layer from Default to another layer Ive tried them all, and didnt work.
     
  6. aplusgreenlawn

    aplusgreenlawn

    Joined:
    Nov 14, 2023
    Posts:
    16
    Ive used the Debug.Log to check if everything is working correctly and it is just the state of status: Standby wont change to Live.
     
  7. aplusgreenlawn

    aplusgreenlawn

    Joined:
    Nov 14, 2023
    Posts:
    16
    funny thing though when in gameplay If i press the Solo button on Shoot vcam1 it goes status: Live , but wont turn of after clicking my aim buttron
     
  8. aplusgreenlawn

    aplusgreenlawn

    Joined:
    Nov 14, 2023
    Posts:
    16
    Okay so I have figured out what my problem was, I have a Cinemachine Virtual Camera that runs on a Dolly and Track that shows my game scene on Awake(). So I unchecked it on the Director (GameObject, Playable Director Component) in Inspector! And Viola!! My Aim cam worked no Problem.
    Well the only problem was my cutscene that starts on Awake() didnt play anymore when game started. So I had a script for Virtual cameras to shut off Main cam when Shoot vcam3 is active, so in script i changed the [SerializeField] ( private CinemachineVirtualCamera mainCamera:) Field to (private GameObject mainCamera;) and in the component for ThirdPersonShooterController, I threw in the GameObject (Director) and turned back on Play On Awake()!!
    What I got then was everytime I Aimed it worked, but cutscene played after every Aim! So in the script instead of turning the Director back on in the (else) statement I noted it out with ( // )...
    Now my cutscene Director works on Awake() as desired but even better if I dont want to wait for it on Start() I can just press Aim button and skip it!! (Came Out Perfect). The main cutscene was kind of annoying but its there and i still want it there. But if anyone else is having problems with Virtual Cameras not Working meaning (They turn on but stay in Standby) Maybe the Director GameObject is the problem!
    Im pretty proud of myself figuring this out Its been a week or more of working on it and I had to figure it out all on my own, considering Im basically clueless to this stuff right now. I'm posting the script so you all can see what I'm talking about and maybe it helps someone else, since Ive been trying to find out how to fix this problem for over a week now, and couldnt find the answer anywhere on the net.


    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Cinemachine;
    using System.Runtime.InteropServices.WindowsRuntime;

    public class ThirdPersonShooterController : MonoBehaviour
    {
    [SerializeField]
    private CinemachineVirtualCamera aimVirtualCamera;

    [SerializeField]
    private GameObject mainCamera;

    private PlayerShooting playerShooting;

    private void Awake()
    {
    playerShooting = GetComponent<PlayerShooting>();
    }

    private void Update()
    {

    if (playerShooting.aim) {
    mainCamera.gameObject.SetActive(false);
    aimVirtualCamera.gameObject.SetActive(true);
    }
    else
    {
    // mainCamera.gameObject.SetActive(true);
    aimVirtualCamera.gameObject.SetActive(false);
    }
    }
    }
     
  9. aplusgreenlawn

    aplusgreenlawn

    Joined:
    Nov 14, 2023
    Posts:
    16
    Anyway so now I get this Null Refference Error:
    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.Graphs.Edge.WakeUp () (at <d7c8a94f4aa44e31b1f3c29d56ad2bf5>:0)
    UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at <d7c8a94f4aa44e31b1f3c29d56ad2bf5>:0)
    UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at <d7c8a94f4aa44e31b1f3c29d56ad2bf5>:0)
    UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at <d7c8a94f4aa44e31b1f3c29d56ad2bf5>:0)
    UnityEditor.Graphs.Graph.WakeUp () (at <d7c8a94f4aa44e31b1f3c29d56ad2bf5>:0)
    UnityEditor.Graphs.Graph.OnEnable () (at <d7c8a94f4aa44e31b1f3c29d56ad2bf5>:0)

    I think its because I noted out ( //mainCamera.gameObject.SetActive(true); )

    Im going to try un noting it and putting (false) to see if that fixes it