You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SafePadding renders incorrect padding on non-mobile platforms in 2019.3 and Device Simulator 2.+
As a workaround, I use the following scripts:
/// <summary>/// Provides a replacement for <see cref="Application"/> that better reports the platform currently being used./// </summary>publicstaticclassEditorCompatibleApplication{publicstaticRuntimePlatformplatform{get{
#if UNITY_ANDROIDreturnRuntimePlatform.Android;
#elif UNITY_IOSreturnRuntimePlatform.IPhonePlayer;
#elif UNITY_STANDALONE_OSXreturnRuntimePlatform.OSXPlayer;
#elif UNITY_STANDALONE_WINreturnRuntimePlatform.WindowsPlayer;
#elif UNITY_WEBGLreturnRuntimePlatform.WebGLPlayer;
#endif
}}publicstaticboolisLandscape=>Camera.main.aspect>1f;publicstaticboolisMobilePlatform{get{
#if UNITY_EDITOR// Game is being played in the editor and the selected BuildTarget is either Android or iOSif(EditorUserBuildSettings.activeBuildTarget==BuildTarget.Android||EditorUserBuildSettings.activeBuildTarget==BuildTarget.iOS){returntrue;}
#endif
// Game is being played on an Android or iOS deviceif(platform==RuntimePlatform.Android||platform==RuntimePlatform.IPhonePlayer){returntrue;}// Game is being played on something other then an Android or iOS deviceelse{returnApplication.isMobilePlatform;}}}}/// <summary>/// Disables the safe area when in WebGL, since it appears to misread the device stats in 2019.3./// </summary>publicsealedclassSafeAreaInfluenceFix:UIBehaviour{[SerializeField]privateSafePaddingm_Target;privatevoidStart(){if(!EditorCompatibleApplication.isMobilePlatform){StartCoroutine(SetInfluence(0f));}else{StartCoroutine(SetInfluence(1f));}}privateIEnumeratorSetInfluence(floatvalue){m_Target.influence=value;yieldreturnnewWaitForEndOfFrame();m_Target.enabled=false;yieldreturnnewWaitForEndOfFrame();m_Target.enabled=true;}}
The text was updated successfully, but these errors were encountered:
SafePadding
renders incorrect padding on non-mobile platforms in 2019.3 and Device Simulator 2.+As a workaround, I use the following scripts:
The text was updated successfully, but these errors were encountered: