Search Issue Tracker
NullReferenceException in MobileControlRig.EnableControlRig after switching platform in Editor
Steps to repro:
1. Open attached project;
2. Go to BuildSettings (File -> Build Settings);
3. Select any other available platform (i.e. WebGL);
4. Click Switch Platform.
Platform is switched without errors.
UnityStandardAssets.CrossPlatformInput.MobileControlRig.EnableControlRig (Boolean enabled) (at Assets/Standard Assets/CrossPlatformInput/Scripts/MobileControlRig.cs:89)
UnityStandardAssets.CrossPlatformInput.MobileControlRig.CheckEnableControlRig () (at Assets/Standard Assets/CrossPlatformInput/Scripts/MobileControlRig.cs:82)
UnityStandardAssets.CrossPlatformInput.MobileControlRig.OnActiveBuildTargetChanged (BuildTarget previousTarget, BuildTarget newTarget) (at Assets/Standard Assets/CrossPlatformInput/Scripts/MobileControlRig.cs:98)
UnityEditor.Build.BuildPipelineInterfaces.OnActiveBuildTargetChanged (BuildTarget previousPlatform, BuildTarget newPlatform) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:345)
is thrown in the console. See attached video.
- Reproducible in 2017.2.0b3, 2017.1.0f3;
- The code doesn't compile in 5.6.1p2;
- Reproducible on Windows 10;
- Uncommenting line 82 in 'MobileControlRig.cs' script fixes the issue.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Long Prefab save times when using Unity 2022.2 and higher
- Console displays error "UnityException: Creating asset at path Assets/Scenes/ .scenetemplate failed." during scene template saving
- "Development Build" watermark is shown in non-development UWP release builds
- Console errors appear when the Inspector is set to Debug and a GameObject is selected
- A script public variable value is not used when set in the Inspector window
Apr 13, 2021 12:25
I tried everything that was posted here, but nothing worked.
I tried changing the namespace, deleting the "using Systems;"
I tried everything and the error is still there.
May 26, 2020 21:36
If you downloaded standard assests go into MobileControlRig script and get rid of using system;
then write this
should work. It worked for me.
Apr 24, 2019 01:44
Same here. 2018.3.0f2
Don't know how this affects since I'm still able to build the game for Android (and no issues playing it).
Apr 21, 2019 13:05
This is still happening
Apr 01, 2019 14:41
Também estou com esse erro ao tentar usar prefab MobileSimgle não os botões ficam bloqueado e da esse erro não dá pra ativar os botões
Mar 27, 2019 08:42
This error is still there in 2018.3.6...
Jan 30, 2019 15:02
Issue not resolved in 2018.2.20f1
Dec 16, 2018 10:10
Also ran into this problem in 2018.3
Dec 02, 2017 13:31
Change de namespace to
if has error about UnityEngine dont found, use
Oct 13, 2017 12:01
Also got this bugg when trying to build for OSX on my PC.