Search Issue Tracker
By Design
Votes
1
Found in
2017.2.0b3
Issue ID
930177
Regression
No
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.
Expected result:
Platform is switched without errors.
Actual result:
Error:
NullReferenceException
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)
UnityEditor.Build.BuildPipelineInterfaces:OnActiveBuildTargetChanged(BuildTarget, BuildTarget)
is thrown in the console. See attached video.
Notes:
- 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.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash when trying to force Shader to interpret 1/30 as a floating point operation
- Terrain is flickering when adjusting "Compatibility Mode" and "Use Rendering Layers" Settings
- Isometric tiles are flickering and overlapping each other when entering Play Mode with Tilemap Renderer mode set to "Chunk"
- Crash on ParticleSystemParticles::array_reserve when particle system starts
- Docking Text Property Preview Window next to UI Builder breaks the window and causes NullReferenceException
mahneovu
Jan 23, 2024 10:28
happens in 2019.4.10f1 when switching to Standalone from Android
HapyTheRealOne
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.
Neuroticism-
May 26, 2020 21:36
If you downloaded standard assests go into MobileControlRig script and get rid of using system;
then write this
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
should work. It worked for me.
Dusko9
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).
40detectives
Apr 21, 2019 13:05
This is still happening
BrianTK
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
Thorgaer
Mar 27, 2019 08:42
This error is still there in 2018.3.6...
TheNenet
Jan 30, 2019 15:02
Issue not resolved in 2018.2.20f1
Spikeyo
Dec 16, 2018 10:10
Also ran into this problem in 2018.3
Juan_Luis
Dec 02, 2017 13:31
Solution:
Change de namespace to
namespace Standard_Assets.CrossPlatformInput.Scripts
if has error about UnityEngine dont found, use
#if UNITY_EDITOR
using UnityEditor;
#endif