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

Input Action Reference won't disable on Cinemachine

Discussion in 'Cinemachine' started by schwmm, Feb 4, 2021.

  1. schwmm

    schwmm

    Joined:
    Oct 20, 2020
    Posts:
    53
    Hi,

    I've posted this over at the Input System Forum a few days ago but are getting little response... maybe some here had the same problem and could help me out?

    I recently switched my project over to the new Input system. I use the auto-generated C# script to reference it and to enable / disable my player inputs. This works well and i like the modularity of the system a lot.
    However, in addition I control a freelook camera with a separate action from the same action map - for this I use the ready-to-use Cinemachine Input Provider and select my action as a reference.

    However, if I disable the action map containing the camera controls action, it won't disable and I can still move the freelook camera.

    Why does the action not disable with the rest of the the action map?
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Hi,

    Thank you for reaching out. We found the bug related to your issue. The fix will be in the next release.
     
  3. schwmm

    schwmm

    Joined:
    Oct 20, 2020
    Posts:
    53
    Hi,
    that's great, I'm looking forward to the next release then - thanks for looking into it!
     
    gaborkb likes this.
  4. schwmm

    schwmm

    Joined:
    Oct 20, 2020
    Posts:
    53
    @gaborkb I hope it's okay to hijack my own thread with a different topic but it is related to the same base scenario. I noticed that when using the Cinemachine Input Provider, the acceleration on a freelook camera appears to be framerate dependent. It is very noticeable when I lower my framerate to 30-40 and use the mouse to move the camera - it is much more sensitive and reacts to minor movements compared to its sensitivity at higher framerates.

    This does not seem to be the case when using the old input system.
     

    Attached Files:

  5. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    That's related to the input system. You can change the update cycle of the input system in Edit ▸ Project Settings ▸ Input System Package ▸ Update Mode.

    By default, it's dynamic, which is frame rate dependent. You could use fixed update or manual. Probably fixed update will be ok in your case, where Time.fixedDeltaTime determines the fps.
     
  6. aalz0r

    aalz0r

    Joined:
    Feb 7, 2021
    Posts:
    3
    @gaborkb I take it this will be in 1.1.0? I'm having the same issue, do you have an idea how I could work around this issue for now?
     
    Last edited: Feb 22, 2021
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    It's in CM 2.7.2, which is now available
     
    gaborkb and aalz0r like this.
  8. aalz0r

    aalz0r

    Joined:
    Feb 7, 2021
    Posts:
    3
    Just updated and it works perfectly! Thank you :)

    Also unrelated but thank you so much for your incredible contribution to this community (and your colleagues too of course!). Countless times I've stumbled upon your useful code snippets and answers to the many questions posted here, many of which I asked myself too at some point. Thanks again for your continuous help!
     
    gaborkb and Gregoryl like this.
  9. manuelnp

    manuelnp

    Joined:
    Oct 29, 2017
    Posts:
    28
    Hi, I think I need to necro this thread, I'm currently using 2.8.4 and still experiencing this issue.

    I created one Action call "look" in one Action Map of the new Input System and configured it as CinemachineInputProvider XY Axis. When I switch between action maps, the "look" action always remains enabled.

    Even If I start the game with no Action Maps enabled, the action assigned to CinemachineInputProvider is enabled.

    Any clue on this?
     
    Last edited: Feb 6, 2022
  10. schwmm

    schwmm

    Joined:
    Oct 20, 2020
    Posts:
    53
    In the end I solved this by creating an InputManager singleton class which creates an instance of my input asset. In this manager class I enable and disable the action maps for this specific instance of the input asset.

    I did not use the provided Input component on the cinemachine but instead read through it to understand how to reference my custom InputManager class instead and then wrote my own script for the cinemachine. This way I am able to switch disable the action map of the correct instance and it works.
     
  11. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    353
    I can confirm I also have 2.8.4 i disable my player input
    Code (CSharp):
    1. gameInput.Player.Disable();
    but my freelook camera still moving, so i install 2.7.3 but i have at this version same issue so looks like never been fixed ?
     
    FizzyEyebrow likes this.
  12. AndreaGalet

    AndreaGalet

    Joined:
    May 21, 2020
    Posts:
    63
    I think i have the same issue, cinemachine free look camera used for third person with the new input system, the camera has the "cinemachine input provider" component added. When i disable the input the player can not move, instead camera is still moving

    Unity 2021.2.11f1 with Cinemachine version 2.8.4
     
  13. AndreaGalet

    AndreaGalet

    Joined:
    May 21, 2020
    Posts:
    63
    A workaround is disabling the "cinemachine input provider" component to stop the camera from moving
     
    FizzyEyebrow likes this.
  14. Zarlin

    Zarlin

    Joined:
    Sep 26, 2017
    Posts:
    3
    I have this same issue. The CinemachineInputProvider does not respect the InputActionMap state, because it auto-enables the input action, so even if the action is disabled via the InputActionMap, it just gets turned on anyway (line 93):

    Code (CSharp):
    1. // Auto-enable it if disabled
    2. if (m_cachedActions[axis] != null && !m_cachedActions[axis].enabled)
    3.     m_cachedActions[axis].Enable();
    I'll probably go the route of making my own script, but it's sad that Unity cannot make the included code work properly with other first-party packages. This is not the first time I've had to roll my own because the included code is inadequate.

    For reference, these are the versions I'm using:
    - Unity 2021.3.8f1
    - Cinemachine 2.8.4
    - InputSystem 1.2.0
     
  15. IndieWafflus

    IndieWafflus

    Joined:
    Jul 26, 2021
    Posts:
    24
  16. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    You are correct, this wasn't fixed.
    There's a PR in flight right now that fixes it for real.
     
    IndieWafflus likes this.
  17. AndreaGalet

    AndreaGalet

    Joined:
    May 21, 2020
    Posts:
    63
    With version 2.8.6 still doesn't work for me. Unity 2021.3.3f1 WebGL
     
  18. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238