Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Add Impulse Listener to Virtual Camera [SOLVED]

Discussion in 'Cinemachine' started by Littlenorwegian, Jan 23, 2019.

  1. Littlenorwegian

    Littlenorwegian

    Joined:
    Oct 19, 2012
    Posts:
    143
    Right, so, in essence. I've made a lot of cameras. And now I want to add impulse listeners to the lot, real basic stuff in a way.

    But I am running into some problems with my code.
    Code (CSharp):
    1. gameObject.GetComponent<CinemachineVirtualCamera>().AddExtension(CinemachineImpulseListener);
    You can see the intent in this simple line of code is just to add a cinemachine impulse listener, but it just states that it's not valid in the current context. So, I'd be really appreciative if I could get some help. Because impulse is perfect for my needs. I just need some help to retrofit it :)
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    Try
    Code (CSharp):
    1. gameObject.AddComponent<CinemachineImpulseListener>();
     
    Littlenorwegian likes this.
  3. Littlenorwegian

    Littlenorwegian

    Joined:
    Oct 19, 2012
    Posts:
    143
    Oh, I am a dumbo. It is a separate component (I thought it was an extension within a component)