- Home /
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
Show us the code related to that button! What action is the button doing?
Thanks @OusedGames
all buttons (right , left , up, down, jump , fire, pause..)
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
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;
}
}
}
can you try removing the pointer up/down events and see if the problem is still there?
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.
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".
Keep in mind that multiple symbols need to be seperated with a semicolon ( ; ) as seen in this screenshot.
omg omg!!!!!!!! thank you very very very very much hhhh wooooow, its worked finally :D
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
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?