Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.

Difference between revisions of "Engine:Unity"

From PCGamingWiki, the wiki about fixing PC games
(Set custom resolution)
(Under "Set custom resolution" -> "Set resolution via command line arguments", the example argument read "-screen-width 1440", when it should be "-screen-height 1440".)
Line 43: Line 43:
 
}}
 
}}
 
{{Fixbox|description=Set resolution via command line arguments|ref=<ref name="bymastan/>|fix=
 
{{Fixbox|description=Set resolution via command line arguments|ref=<ref name="bymastan/>|fix=
Add <code>-screen-width <width> -screen-height <height></code> to the [[Glossary:Command line arguments|command line arguments]]. Optionally add <code>-screen-fullscreen 0</code> for windowed or <code>-screen-fullscreen 1</code> for fullscreen mode, e.g. <code>-screen-width 3440 -screen-width 1440 -screen-fullscreen 1</code> for the fullscreen 3440x1440 mode.
+
Add <code>-screen-width <width> -screen-height <height></code> to the [[Glossary:Command line arguments|command line arguments]]. Optionally add <code>-screen-fullscreen 0</code> for windowed or <code>-screen-fullscreen 1</code> for fullscreen mode, e.g. <code>-screen-width 3440 -screen-height 1440 -screen-fullscreen 1</code> for the fullscreen 3440x1440 mode.
 
}}
 
}}
  

Revision as of 11:20, 20 May 2022

Unity
Unity logo.svg
Developers
Website
First release date

It is possible to manually port a Unity game to other supported operating systems, such as Mac OS or Linux, see Engine:Unity/Porting.

General information

Unity Documentation

Unity Launcher/Configuration Tool

The launcher/configuration tool allows easy customizing of graphics and input related settings of a Unity game.
This tool is not available for all games.
Open the tool for a game
  1. Check if there is a shortcut that allows easy access to the configuration tool.
    • Games on digital distribution platforms (e.g. Steam, Origin) might expose this as an option either through the context menu, or when launching the game.
    • There might be a shortcut for it in the start menu.
    • Holding down Shift or Alt on launch opens it for some games.
  2. If there is no easy way to access the launcher, use the -show-screen-selector command line argument to access it instead.

Manually port the game to other platform or architecture

It is entirely possible to port the game into other platform or architecture, even if it didn't receive the official release, for example to Linux. However, this is heavily dependant on the engine version it was made on as the support started from Unity 4 up to the recent and there may be some issues upon doing it. Engine:Unity/Porting will explain how to make your own unofficial port of the game.

Hardware statistics collection

Games built with Unity automatically upload the player's hardware statistics when first run.

Set custom resolution

Can be applied to many Unity games.
Launcher overrides these settings. If launcher is unskippable then these methods would not work.
Games not designed for high or ultra-widescreen resolutions may have visual glitches or inaccessible menus. If exiting game the normal way is impossible, press Alt+F4 and try other values.
Change values in the registy[1]
  1. Run the game at least once, it will create registry values.
  2. Find game's configuration location in registry. Check Configuration file(s) location of the game's article. General location should be HKEY_CURRENT_USER\Software\<Developer>\<Gamename>.
  3. Change the value of Screenmanager Resolution Width_h182942802 to the desired screen width. Don't forget to switch to the Decimal mode.
  4. Change the value of Screenmanager Resolution Height_h2627697771 to the desired screen height.
  5. Create or change the value of Screenmanager Is Fullscreen mode_h3981298716 to 1 for fullscreen or 0 for windowed mode. (Optional)
  6. Create or change the value of UnitySelectMonitor_h17969598 to 0 to run the game on primary monitor, 1 on secondary monitor, etc. (Optional)
Set resolution via command line arguments[1]

Add -screen-width <width> -screen-height <height> to the command line arguments. Optionally add -screen-fullscreen 0 for windowed or -screen-fullscreen 1 for fullscreen mode, e.g. -screen-width 3440 -screen-height 1440 -screen-fullscreen 1 for the fullscreen 3440x1440 mode.

Borderless fullscreen windowed mode

Most Unity games can be run in borderless fullscreen windowed mode by enabling regular windowed mode and using the -popupwindow command line argument.
Most games using Unity 5 run in the new default fullscreen mode. However its behaviour differs from earlier games' borderless mode and it's still possible to use launch parameter to use earlier borderless mode instead of new one.

Exclusive fullscreen mode

Some Unity games will only run in borderless fullscreen windowed mode. To enable exclusive fullscreen mode use the -window-mode exclusive command line argument.

VR and stereoscopic modes

Unity 5.1 onwards has native support for VR devices.[2] It's possible to force different VR modes, however results may vary if the game wasn't build for VR. To force VR mode, use -vrmode DEVICETYPE Command line argument and replace the DEVICETYPE with following:
Parameter Description
None No VR Device.
Stereo Stereo 3D via D3D11 or OpenGL.
Split Split screen stereo 3D (the left and right cameras are rendered side by side).
Oculus Oculus family of VR devices.
PlayStationVR Sony's PlayStation VR device for PlayStation 4 (formerly called Project Morpheus VR).

Command line arguments

See command line arguments on how to use the following options. Some common arguments are listed below.[3]
Keep in mind that, depending on the engine version and operating system, some options might not be supported.
Parameter Description
-show-screen-selector Forces the screen selector dialog (aka the Unity Configuration Tool) to be shown.
-batchmode Run the game in “headless” mode. The game will not display anything or accept user input. This is mostly useful for running servers for networked games.
-force-opengl (Windows only) Make the game use the legacy OpenGL back-end for rendering, even if Direct3D is available.
-force-glcore Make the game use the new OpenGL back-end for rendering. With this argument, Unity will detect all the features the platform support to run with the best OpenGL version possible and all available OpenGL extensions
-force-vulkan (Windows and Linux only) Make the game use Vulkan for rendering, even if Direct3D or OpenGL is available. Introduced in 5.6 version of the engine.
-force-d3d9 (Windows only) Make the game use Direct3D 9 for rendering. As of Unity 2017.3 the D3D9 support has been removed.[4]
-force-d3d9-ref (Windows only) Make the game run using Direct3D’s “Reference” software renderer. The DirectX SDK has to be installed for this to work. This is mostly useful for building automated test suites, where you want to ensure rendering is exactly the same no matter what graphics card is being used.
-force-d3d11 (Windows only) Make the game use Direct3D 11 for rendering.
-single-instance (Linux & Windows only) Allow only one instance of the game to run at the time. If another instance is already running then launching it again with -single-instance will just focus the existing one.
-nolog (Linux & Windows only) Do not produce output log. Normally output_log.txt is written in the *_Data folder next to the game executable, where Debug.Log output is printed.
-adapter N (Windows only) Allows the game to run full-screen on another display. The N maps to a Direct3D display adaptor. In most cases there is a one-to-one relationship between adapters and video cards. On cards that support multi-head (they can drive multiple monitors from a single card) each “head” may be its own adapter.
-popupwindow (Windows only) The window will be created as a a pop-up window (without a frame).
-screen-fullscreen Override the default full-screen state. This must be 0 or 1.
-screen-width (Linux & Windows only) Overrides the default screen width. This must be an integer from a supported resolution.
-screen-height (Linux & Windows only) Overrides the default screen height. This must be an integer from a supported resolution.
-screen-quality (Linux only) Overrides the default screen quality. Example usage would be
-nographics (Linux & Windows only) When running in batch mode, do not initialize graphics device at all. This makes it possible to run your automated workflows on machines that don’t even have a GPU.
-force-wayland (Linux only) This command will force the engine to use Wayland display instead of XOrg (Which under Wayland session will use XWayland and cause some performance loss), you must run in a desktop environment which has Wayland session available to work. It is currently experimental

Graphical presets

By default, games using the Unity engine only come with a few graphics presets: Fastest, Fast, Simple, Good, Beautiful, and Fantastic. The developer can choose not to use them and use more fine-grained graphics options in-game.
There isn't any way to change the predefined graphics presets.
The Unity launcher is not navigable with a controller.
The following table is a list of Unity's default presets (as of version 4.5.4):
Fantastic Beautiful Good Simple Fast Fastest
Rendering
Pixel Light Count 4 3 2 1 0 0
Texture Quality Full Res Full Res Full Res Full Res Full Res Half Res
Anisotropic Filtering Forced On Forced On Per Texture Per Texture Disabled Disabled
Antialiasing 2X Multi Sampling 2x Multi Sampling Disabled Disabled Disabled Disabled
Soft Particles On On Off Off Off Off
Shadows
Shadows Hard and Soft Shadows Hard and Soft Shadows Hard and Soft Shadows Hard Shadows Only Disable Shadows Disable Shadows
Shadow Resolution High Resolution High Resolution Medium Resolution Low Resolution Low Resolution Low Resolution
Shadow Projection Stable Fit Stable Fit Stable Fit Stable Fit Stable Fit Stable Fit
Shadow Cascades Four Cascades Two Cascades Two Cascades No Cascades No Cascades No Cascades
Shadow Distance 150 70 40 20 20 15
Other
Blend Weights 4 Bones 4 Bones 2 Bones 2 Bones 2 Bones 1 Bone
Vsync Every VBlank Every VBlank Every VBlank Don't Sync Don't Sync Don't Sync
LOD Bias 2 1.5 1 0.7 0.4 0.3
Particle Raycast Budget 4096 1024 256 64 16 4

Issues unresolved

Can't use x360ce or Durazno

x360ce and Durazno are incompatible due to the Unity input manager using Raw Input instead of XInput.[5] See Controller for other alternatives.

Can't force anti-aliasing (NVIDIA users)

Unity games typically ignore forced anti-aliasing settings, resulting in poor image quality in games which could benefit from anti-aliasing.
Modify game's NVIDIA game profile[6][7]
  1. Download and launch the NVIDIA Profile Inspector.
  2. Using the dropdown list at the upper-left side of the window, select the name of the Unity game you wish to force anti-aliasing on.
  3. Under Antialiasing Compatibility, set the value to 0x004000C1
  4. Under Antialiasing - Mode, set the value to Override any application settings
  5. Under Antialiasing - Setting, set the value to your desired anti-aliasing level. (Typical values include 2x,4x, and 8xQ.)

Notes:

Antialiasing cannot be forced for games using DirectX 10 or newer.
Not all Unity games may be compatible with this fix.

2D elements are vert- on non-standard aspect ratios

While Unity's 3D render is Hor+ by default, 2D elements such as HUD graphics or 2D renders are Vert- by default, and may be cut-off on non-standard aspect ratios such as ultra-widescreen or multi-monitor setups.

Issues fixed

Crash on launch for games based on some versions of Unity 2017 and 2018

Unity build 2017.3.0f3, among other versions, has a bug that causes games to crash immediately on startup if the Citrix Indirect Display Adapter device is installed in Device Manager of Windows. This virtual display adapter ships as part of Citrix Workspace (formerly Citrix Receiver) solution.[8][9]
Uninstall Citrix Workspace.[9]

Spinning camera, menus scrolling automatically

This is stock engine behaviour with controllers other than Xbox 360 Controller and may require developer to fix it. See Controller article for more details.

Low performance

Common issue especially with laptops, where engine uses integrated GPU instead of more powerful dedicated one.
Use dedicated GPU[citation needed]

On desktops:

  • Make sure monitor is plugged into the dedicated GPU.

On laptops and other mobile devices:

  • Force use of dedicated GPU through either Nvidia control panel or AMD Catalyst Control Center, either globally or game-specific profile.

Multiple keystrokes with a simple key press when using GNOME desktop on Linux

Disable XModifier in launch options[10]

Add the following command into Launch Options if you are on Steam:

XMODIFIERS='' %command%

For non-Steam games create/open .sh script file and add:

#!/bin/bash (Not needed if the .sh script file already includes it)

XMODIFIERS='' ./game_executable

Graphical distortions appear on NVIDIA 415.22 driver (Linux)

Adding -force-clamped after one of these command lines will make the game sure to remember the specified renderer you have forced.
Launch the game with -force-vulkan OR -force-glcore42.[11]

Keyboard inputs multiple times with one key press (Linux)

Launch the game with XMODIFIERS= (Include %command% if a game is on Steam) or replace the SDL2 library included with the game with the one from your system (In Steam's case run the client in Native mode)[12]


References