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

Getting Touch Cross-Platform Input working in Unity 5?

Discussion in 'UGUI & TextMesh Pro' started by AuroraUnit, Mar 9, 2015.

  1. AuroraUnit

    AuroraUnit

    Joined:
    Aug 7, 2013
    Posts:
    5
    Maybe I'm missing something, but I'm not able to get any of the cross-platform input prefabs included in Unity 5 to work. I've enabled mobile input, I've made builds for my Android device, and tried using the remote app, and nothing is working. I've tried multiple prefabs with no luck.

    What do I have to do to get these to work? I'm just using the standard, provided character controllers, so I don't think there'd be a compatibility issue. Are these prefabs dependent on where they are placed inside the hierarchy?

    Any help would be greatly appreciated.
     
    dousi96 and Deleted User like this.
  2. Bonfi_96

    Bonfi_96

    Joined:
    Oct 2, 2013
    Posts:
    34
    Having the same problem here, it would be very helpful if someone manages to make them work
     
  3. Deleted User

    Deleted User

    Guest

    Same here! And searching there is more people asking the same without any reply.
     
  4. ShloobSurprise

    ShloobSurprise

    Joined:
    Oct 3, 2013
    Posts:
    2
    Same here!
     
  5. Deleted User

    Deleted User

    Guest

  6. dousi96

    dousi96

    Joined:
    Jul 28, 2014
    Posts:
    23
    Same problem!!! The joystick work in the editor but not on my Lumia 925
     
  7. mr_rayskinner

    mr_rayskinner

    Joined:
    Nov 16, 2013
    Posts:
    37
    I couldn't figure out for the life of me why i couldn't get this working...then I read the readme file.
    Make sure to have :

    using UnityStandardAssets.CrossPlatformInput

    in your control script(s)

    and replace all "Input" with "CrossPlatformInputManager" .

    For Instance :

    Input.GetAxis would then become CrossPlatformInputManager.GetAxis

    Worked for me, hope it helps someone else
     
    ivaylo5ev, mgear, spab and 4 others like this.
  8. SummitJain

    SummitJain

    Joined:
    May 30, 2014
    Posts:
    12
    The input system for a fps mouse look is driving me crazy..

    They have written the code in the standard assets in the crossplatform input in the First person controller script and mouseLook.cs script which takes the input from the Script but it does not take any input value while in the editor or in the mobile phone or using Unity remote.

    CrossPlatformInputManager.GetAxis("Mouse X") does not give any value. its is always zero. Build the product and checked the mouse movement in the FPS prefab and script does not work.

    The input value of CrossPlatformInputManager.GetAxis("Mouse X") or MouseY both does not respond at all.

    What the hell is wrong in the standard assets and the scripts which i have mentioned.

    Any answers will be much appreciated. Thanks.
     
  9. mr_rayskinner

    mr_rayskinner

    Joined:
    Nov 16, 2013
    Posts:
    37
    I'm not entirely sure of the context but usually GetAxis is evaluated in a Boolean statement like so :

    if(CrossPlatformInputManager.GetAxis("Mouse X") > 0)
    {
    //do something
    }
    else if(CrossPlatformInputManager.GetAxis("Mouse X") < 0)
    {
    // do something else
    }

    How are you using GetAxis in your code?
     
  10. naryk86

    naryk86

    Joined:
    May 28, 2017
    Posts:
    4
    Hello! I think it is a boring question for experts, but I'm a novice... I've already seen this post ( http://answers.unity3d.com/questions/862349/how-to-use-unity-cross-platform-input.html ) but mine is the same as topic.
    I've developed a prototype 2D infinite runner game following the "live training" session (adapting it to the new possibilities of Unity2017) and I'd like to test it on my android device. As explained in the tutorial, i've used the 2d mobile controller and i've adapted the code to make player always running and control just "jump" action. I've seen that in the Standard Asset package there is a txt file which explain what to do to enable and use mobile input controls so it should be simple... but i always fail.
    If i build my game for "standalone" the script automatically let me to use spacebar to make player jump, but when I compile for "android" no touch input seems enabled.

    Could you gently explain what to do, step by step? (I need just "jump" action, so also solution different from "standard assets scripts" could be of my interest...)

    Thanks in advance
     
  11. AlejandroBoss10

    AlejandroBoss10

    Joined:
    Sep 1, 2017
    Posts:
    7
    THANK YOU SOO MUCH. I was looking all over for something like this and you have been a great help. You have saved me hours of work! Thank you. Just checked and this DOES work with Unity 2017.1.1f1. thank you
     
  12. wholesomeisland

    wholesomeisland

    Joined:
    Feb 19, 2018
    Posts:
    5
    it did not work for me. but I was not using the car in standard assets.
     
  13. LIGHTX

    LIGHTX

    Joined:
    Aug 14, 2015
    Posts:
    1
    Check Axis name given to them in standard asset script might not be Mouse X or Mouse Y .. Can be Horizontal and Vertical or something else