Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jun 01, 2018 at 07:45 AM by Choukri.
avatar image
1
Question by Choukri · Jul 03, 2017 at 03:54 PM · uiinputbuttonbuttonscontrols

This is not possible to be called for standalone input. Please check your platform and code where this is called (C#)

Hi i have this error when i press any button UiControls (not working) thanks all

Exception: This is not possible to be called for standalone input. Please check your platform and code where this is called

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image OusedGames · Jul 04, 2017 at 02:11 AM 0
Share

Show us the code related to that button! What action is the button doing?

avatar image Choukri OusedGames · Jul 04, 2017 at 03:49 PM 0
Share

Thanks @OusedGames

all buttons (right , left , up, down, jump , fire, pause..)

alt text

unity-error.png (377.2 kB)
avatar image FunIsDangerous Choukri · Jul 04, 2017 at 03:51 PM 0
Share

double-click the error and it should take you to a certain line of code. send us the entire function in which this line is in

Show more comments
avatar image Choukri OusedGames · Jul 05, 2017 at 03:48 PM 0
Share

using System; using UnityEngine;

namespace UnityStandardAssets.CrossPlatformInput.PlatformSpecific { public class StandaloneInput : VirtualInput { public override float GetAxis(string name, bool raw) { return raw ? Input.GetAxisRaw(name) : Input.GetAxis(name); }

     public override bool GetButton(string name)
     {
         return Input.GetButton(name);
     }


     public override bool GetButtonDown(string name)
     {
         return Input.GetButtonDown(name);
     }


     public override bool GetButtonUp(string name)
     {
         return Input.GetButtonUp(name);
     }


     public override void SetButtonDown(string name)
     {
         throw new Exception(
             " This is not possible to be called for standalone input. Please check your platform and code where this is called");
     }


     public override void SetButtonUp(string name)
     {
         throw new Exception(
             " This is not possible to be called for standalone input. Please check your platform and code where this is called");
     }


     public override void SetAxisPositive(string name)
     {
         throw new Exception(
             " This is not possible to be called for standalone input. Please check your platform and code where this is called");
     }


     public override void SetAxisNegative(string name)
     {
         throw new Exception(
             " This is not possible to be called for standalone input. Please check your platform and code where this is called");
     }


     public override void SetAxisZero(string name)
     {
         throw new Exception(
             " This is not possible to be called for standalone input. Please check your platform and code where this is called");
     }


     public override void SetAxis(string name, float value)
     {
         throw new Exception(
             " This is not possible to be called for standalone input. Please check your platform and code where this is called");
     }


     public override Vector3 $$anonymous$$ousePosition()
     {
         return Input.mousePosition;
     }
 }

}

avatar image FunIsDangerous Choukri · Jul 05, 2017 at 06:53 PM 0
Share

can you try removing the pointer up/down events and see if the problem is still there?

Show more comments

2 Replies

  • Sort: 
avatar image
6
Best Answer

Answer by Bunny83 · Jul 06, 2017 at 01:44 AM

You use the CrossPlatformInput StandardAssets package. This package adds a new menu item to your Unity editor called "Mobile Input". There you have to make sure you select "Enable". This will add a compiler directive to all Mobile build settings (specifically "MOBILE_INPUT"). This directive will make the CrossPlatformInput controller to use the Mobile implementation.

How to enable mobile input

The relevant code is in the static constructor of the CrossPlatformInputManager class:

 static CrossPlatformInputManager()
 {
     s_TouchInput = new MobileInput();
     s_HardwareInput = new StandaloneInput();
 #if MOBILE_INPUT
     activeInput = s_TouchInput;
 #else
     activeInput = s_HardwareInput;
 #endif
 }

The "StandaloneInput" class does not support setting the state of an axis or button as it directly used Unity's Input class. The MobileInput class on the other hand uses virtual input axis which can be driven by buttons.

edit
If for some reason you don't have that menu item (which would be the case when you did not import the editor scripts from that CrossPlatformInput package), you can add the compiler symbol yourself in the build settings. Just go to File --> Build Settings and make sure you have selected a mobile platform as target. Then click "Player Settings" at the bottom. In the inspector under "Other Settings" you will find the "Scripting Define Symbols".

Mobile input define

Keep in mind that multiple symbols need to be seperated with a semicolon ( ; ) as seen in this screenshot.


enablemobileinput.png (2.5 kB)
mobile-input-define.png (6.1 kB)
Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Choukri · Jul 06, 2017 at 06:22 PM 0
Share

@Bunny83

omg omg!!!!!!!! thank you very very very very much hhhh wooooow, its worked finally :D

avatar image Mr-Asad955 · Jun 28, 2020 at 06:31 PM 0
Share

this helps alot, also make sure that you dont have any duplicate script in the project, because when i first apply this answer it didnt work but when i deleted the duplcate standard assets scripts, it worked, Thanks

avatar image thawzi · Aug 30, 2020 at 09:10 AM 0
Share

Thank You bro It's working!

avatar image nareshbishtasus · Jan 07, 2021 at 08:39 PM 0
Share

Worked Sexily. Thank you.

avatar image
1

Answer by toddisarockstar · Jul 04, 2017 at 06:24 PM

Um.... sorry to sound so obvios. but have you gone to file/build setting and make sure you have the proper platform selected? if you are building for mobile or webplayer, Maybe you are accidentally set for a Windows build?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Choukri · Jul 04, 2017 at 06:34 PM 0
Share

@toddisarockstar yes i use Android but nothing work ! :/

Follow this Question

Answers Answers and Comments

122 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why does the keyboard control what button is selected? 2 Answers

How to spawn an 2D sprite with a button 1 Answer

OVRInput keys are not working 0 Answers

Button highlighted a pushable without touching it 0 Answers

Find out if any Button on any Gamepad has been pressed and which one 6 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges