Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Default installation of the New Input System breaks cinemachine (Or is cinemachine broken?)

Discussion in 'Input System' started by altepTest, Nov 3, 2021.

  1. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,132
    Create new project in Unity version 2021.2.0f1

    in the project settings then Input System Package there is a drop down menu with three options. The default is "Process Events in Fixed Update"

    this option breaks cinemachine cameras where rotating using the mouse will not be smooth but the cameras rotation will behave erratically, jumping or randomly accelerating or decelerating.

    You can test this both by create a custom cinemachine setup or by importing the unity created new Starter Assets Third Person Controller.

    "Process Events in Fixed Update" will not work correctly.

    If you set the option to "Process Events in Dynamic Update" will fix the cinemachine camera issue. Cinemachine camera rotations with the mouse will work perfectly and smoothly as they should.

    QUESTION

    What these two options do? Which we should use in the Input System? the fixed or dynamic?

    Is this option set up wrong in the Unity version 2021.2.0f1 or is set up correctly and cinemachine asset is broken?
     
  2. https://docs.unity3d.com/Packages/com.unity.inputsystem@1.2/manual/Settings.html#update-mode

    Changes when the InputSystem updates. Which should you use is up to you, if you want to tie your input to the physics updates, then FixedUpdate, if you want to tie it to rendering, then Update.

    Cinemachine isn't working with physics at all, having its input in FixedUpdate does this. You need to write your own input module for Cinemachine. More info here.
     
  3. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,132
    Nope, I think you have missed the point. Thank You for clarifications on what those options mean btw, is more clear now

    but the link you have sent is exactly how cinemachine is set up on my project using the new input system. And how cinemachine is controlled in the third party character controller created by unity team. Both are broken using the fixed update.

    By your example one should either use cinemachine or the physics system with the new input system, not both. That doesn't make any sense.

    Also, why I need to write my own implementation, and how can I figure out to make these three systems, physics, cinemacine and input system work togheter on my side. When these are modules created by unity.

    Is not some third party item from the asset store.
     
  4. Because it is not common to use them in
    FixedUpdate
    . It is not what they made for.

    The link I sent to you states clearly that the class you're looking at serves as an example how to implement your special handling of
    FixedUpdate
    input.

    With all that said I see very little, practically non-existent reason to feed Cinemachine from
    FixedUpdate
    input. To be honest, I see very little reason to read inputs from
    FixedUpdate
    , except when you're doing almost everything in
    FixedUpdate
    because you have a highly physics-driven game. If you're using Cinemachine, you do not.
     
    Last edited by a moderator: Nov 3, 2021
  5. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,132
    We are argue on two different reasons and I'm definitely not saying you are not right on a lot of points. Don't get me wrong, I'm not argue anything on what you are saying.

    In unity 2021.2 by default when you install the input system, the option is set to "fixed update" I can assure you that was not the case for previous versions as I've used the input and cinemachine in the past and all worked fine. So it was on "dynamic update"

    Unity created a starup third person controller implementation as an example on how to move your character around. They use the new input system and the cinemachine. Also that worked fine when it was released and when I've test it on previous editor versions

    Problem is that for some reason in the unity 2021.2 version they have changed the option to be by default "fixed update". I understand why this is important as you have explained.

    But

    This made me lost one day trying to figure out WHY the same steps I did to make cinemachine works with the new input system a few months ago doesn't produce the same results. I've first debugged and looked at my code for hours, then I've downloaded the third person controller made by unity since I remembered it was working fine and tested. That was broken too. So that change broken the implementation of the example unity provided us on how to use cinemachine with the new input system.

    Finally after more time spent searching the forums for some bug I have no idea existed I found one user mentioning that option, which when changing from fixed to dynamic fixed everything.

    So I'm asking how I implement cinemachine with the new input system that works with that new option that "fixed" option that appears to be important.

    You can't say is not unusual to have the cinemachine working with that option.

    And in this case unity needs to provide example on how to use these because all these systems are created by unity. I have no idea how to make them work nicely togheter.

    The example unity provided for the third person controller is broken so I assure you the people that create that example know more about programming and unity than me. Honestly I have small chances to figure out something THEY got wrong :(

    Do you know how can I use these systems togheter?
     
  6. It was not default FixedUpdate for me. You either have an asset which switched to that or you found some sort of bug (or you switched it, just forgot it... at least I've done that before :D). It is NOT normal. Update should be the default at all times.
    Sorry, I can't help with that, I don't use that at all. I use very specific things to prototype.
     
  7. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,132
    strange. I've created a new hdrp project, added the new input system and the options was like that. maybe if one creates a different type of project, from a different starting template may be be different? did you have tried on the 2021.2.0f1 version?

    edit:

    I think the new input is already installed by default on 2021.2.0f1. I honestly can't recall if I install it or it was already there :D I'm a bit tired and I don't want to create a new project right now to check
     
  8. MervayB

    MervayB

    Joined:
    Jan 18, 2020
    Posts:
    5
    Wow, thanks! You have just solved my problem! I had the same issue. Some clarification, though.

    I started 2 projects, one HDRP and 1 URP. Both are in Unity 2021.2.11f. I imported the FPS starter asset into the URP one, and had the same issue as you (Project Settings -> Input System Package -> Update Mode was set to Fixed Update by default).
    However, in the HDRP project, I imported the Input package and Cinemachine manually (I used the "3D (HDRP) Core" template when creating the project, so Cinemachine was not included). My aim was to create my controller, becasue I could not figure out what was wrong with the starter FPS pack. Everything worked fine. Now, that I found this forum post, I checked the Project Settings, and what you know, Update Mode is set to Dynamic by default, and it cannot even be changed, only if you create a new settings asset.

    OFFTOPIC:
    Having all these systems as packages in fine in theory (do not need Cinemachine? Fine, your editor in not bloathed with it by default!), but in practice one change in a particular system can change the behaviour or another, and because neither is part of the editor by default, fixing becomes harder and more tedious. You need systems as separate packeges, certainly. However, the new input system and Cinemachine are examples (at least in my opinion) that should come default with the engine.
     
  9. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,132
    actually a few months later I can say that I was wrong in saying that changing from Fixed to Dynamic fixed the issue. It appeared like that when I've say it but the movement of the camera is not perfect using Dynamic. It still appears jerky not smooth. Is quite annoying.

    I was feed up with this and I've installed unreal and I've create a default third person project. And the movement of the mouse is smooth as butter in that engine. Is quite visible if you try them side by side.

    Not easy to explain with words but just by comparing you will see.

    I've lost two years trying to make my game work with unity and always had issue like this. small annoying issues that are never fixed and are ignored by unity. I've invested some money in the asset store, not much, I have a very limited budget.

    I've cut my losses and the time lost and I'm currently abandoning unity. I don't know if unreal will work but I will give it a try.

    At least I can bring some knowledge of game design to unreal at least I'm not starting from scratch but I'm still very angry of how stupid I was by pursuing for years when the writing was on the wall in front of me all along.

    I really like this engine and the editor(unreal editor is so idiotic with all those big buttons and crap everywhere) but if I can't make it work what can I do?

    If you are starting your journey in making games as I was two years ago I suggest to be careful and try some other options too before committing your time

    It depends of what game you want to do, but for me, this engine was a mistake and a time waste. :(