Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Cant Access CinemachineFramingTransposer ?

Discussion in 'Cinemachine' started by Terraya, Oct 11, 2020.

  1. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    Hey there!

    Im trying to change from my selfmade camera system to cinemachine since it looks quiet good,

    the problem here is, i cant realy access its values, or am i doing something wrong?

    Code (CSharp):
    1. using UnityEngine;
    2. using Cinemachine;
    3.  
    4. namespace TDSStudio.RPG.Control
    5. {
    6.     public class CinemachineCameraController : MonoBehaviour
    7.     {
    8.         [SerializeField] private CinemachineVirtualCamera vcam;
    9.         private CinemachineFramingTransposer camTransposer;
    10.  
    11.         private void Awake()
    12.             => camTransposer = vcam.GetCinemachineComponent<CinemachineFramingTransposer>();
    13.  
    14.         private void Start()
    15.             => Debug.Log(camTransposer.FollowTarget);
    16.     }
    17. }
    Tested on 2020.1.8 / 2020.1.4 and 2019.4 (LTS)

    The Error is , it is always "Null" .. and yes, "vcam" is assigned

    Edit: Also FollowTarget is assigned (just in case i want to mention this as well :) )
     
  2. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    Ahh forget to answer here!

    I Just found it out ... im stupid :)

    for everyone passing by this thread, if you Create a CinemachineVirtualCamera, under "Body" there you can choose between several components which means, if there is 3rd Person Follow for example selected, you wont be able to get the FramingTransposer :)