Forum rules - please read before posting.

Question on Main Camera

Hi
Am I right in thinking that AC GameCameras are just position markers for the main camera, and that when an AC camera goes live, what actually happens is that the main camera is moved to the AC game camera? And that the Unity Camera component on an AC GameCamera doesn't actually do anything?

Olly

Comments

  • edited August 2023

    That's correct - it's similar to how Cinemachine works (which AC also supports), with its Brain and Virtual Camera system.

    Any post-process effects that involve cameras should be attached to the MainCamera.

  • And if you want more properties, post-processing components, etc. of the attached camera to be used by the MainCamera, you can use something like this:

    using UnityEngine;
    using AC;
    
    public class AC_CameraIntegration : MonoBehaviour
    {
        //AC main Camera
        MainCamera _mainCamera;
    
        void Awake()
        {
            //get the AC Main Camera component from the current Unity MainCamera.
            _mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MainCamera>();
    
        }
    
        void Update()
        {
            if (_mainCamera.attachedCamera != null)
            {
    
                Camera.main.clearFlags = _mainCamera.attachedCamera.GetComponent<Camera>().clearFlags;
                Camera.main.backgroundColor = _mainCamera.attachedCamera.GetComponent<Camera>().backgroundColor;
                Camera.main.cullingMask = _mainCamera.attachedCamera.GetComponent<Camera>().cullingMask;
    
                //add more properties here if you want.
    
            }
        }
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.