Search Unity

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,724
    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)