Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

keyboard performance

Discussion in 'Project Tiny' started by bugfinders, Dec 15, 2018.

  1. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,450
    Ive been writing a webgl game, its crappy, but, Ive been stuck with an issue.. I have boiled my issue with my game down to 1 thing. Keyboard input. (while not ECS related as I tried it and had more issues, it is relevant see later) For example,

    If i had an axis defined in input
    Code (CSharp):
    1. float x= Input.GetAxis("Horizontal") * tim* 150.0f;
    then basically movement barely happens under chrome and firefox, semi almost usable in edge.
    However, if I change it to specifically

    Code (CSharp):
    1.         if (Input.GetKey(KeyCode.D)) x =  tim* 150.0f;      
    2.        if (Input.GetKey(KeyCode.A)) x =  -tim* 150.0f;
    then movement happens in an almost usable manner on chrome and firefox when it wasnt before.
    Odd I thought.

    This morning I was playing with the new unity tiny project - , but guess what didnt work? Movement.. In firefox, I tried out the example galaxyraiders - eg a classic space invaiders, only my player wouldnt move, it only moves in edge.. Exactly like what I see in my own game.

    I feel slightly frustrated in that somehow, I feel encouraged to make small web based games, but that the work between unity/webgl/browsers is lacking, if I play the demos in anything other than edge, Im wasting my time.. and people just dont like edge.

    What on earth am I missing?