Unity-Technologies / EntityComponentSystemSamples

Other
7.13k stars 1.6k forks source link

Physics Character Controller Demo not working without INPUT define #194

Open JoelFrutiger opened 3 years ago

JoelFrutiger commented 3 years ago

In order for the Character Chontroller demo to work i had to add the UNITY_INPUT_SYSTEM_EXISTS to the defines. Maybe this should be added per default in the ProjectSettings.asset:

scriptingDefineSymbols: 1: UNITY_POST_PROCESSING_STACK_V2;UNITY_INPUT_SYSTEM_EXISTS

lawrnce commented 3 years ago

@JoelFrutiger Thanks!

AwokeKnowing commented 3 years ago

I add it and it made mouse start working but not keyboard. Its absurdly disheartening that we're dealing with a super mature game dev project with multiple input 'systems' and hundreds of lines of code about moving the player and yet it cannot detect 'WSAD' or any keyboard input, and there's no warnings, no checks nothing. it just doesn't work. I've programming for 25 years and here I am 2 hours later unable to just get it to detect WSAD input to move the character controller of the demo.

I can't believe using the mouse required that crazy define above, and i can't believe this not addressed after months.

MyelinsheathXD commented 3 years ago

Hey! try

if UNITY_INPUT_SYSTEM_EXISTS

AwokeKnowing commented 3 years ago

@myeg yeah i see in the code there are these #if UNITY_INPUT_SYSTEM_EXISTS and I did add that thing on the scripting define symbols, and that makes the mouse work, but not the keyboard.

When using keyboard debugger, i see for example when I press w is says 'character w' and when i press s it says 'format=KEYS' s and in general it's kind of wacko with the mappings. it seems Unity has made some wrong assumption and is relying on some system service it shouldn't, or relying on some mapping that is different for windows vs linux.

But ubuntu 20.04 is current LTS and so it's quite sad that the unity input system doesn't work. if i use getKey directly it works fine. So it's something about the implementation of the input system which tries to be more abstract and universal yet comically fails at it's most core purpose to support WSAD/space/arrows

EDIT: FURTHER INFO: I started a fresh project with just the input system and tanks demo that comes with it. results: When i run the 'remap UI' scene, wsad keys don't trigger anything but zxcv keys trigger [keyboard] 4 [keyboard] 5 [keyboard] 6 [keyboard] 7

That's really weird. it's as though it's shifted 'down' 3 rows. some kind of 'high bit' or something is off. but the keyboard works fine in all other apps

JannikStaub commented 3 years ago

If you are not using the new Input System and dont want to enable this scripting define you can paste this code to the start of the DemoInputGatheringSystem OnUpdate()

if !UNITY_INPUT_SYSTEM_EXISTS

    m_CharacterMovement = new Vector2(UnityEngine.Input.GetAxisRaw("Horizontal"), UnityEngine.Input.GetAxisRaw("Vertical"));
    m_CharacterLooking = new Vector2(UnityEngine.Input.GetAxisRaw("Mouse X"), UnityEngine.Input.GetAxisRaw("Mouse Y"));
    m_CharacterFiring = UnityEngine.Input.GetMouseButton(0) ? 1 : 0;
    m_CharacterJumped = UnityEngine.Input.GetKey(KeyCode.Space);

endif

Electricavisuals commented 2 years ago

Please unity developers, can you fix it? Thks