Buildsetting Gameview On Mac Unity Game

Aug 13, 2014  unity editor script: UnityEditor GameView automatically move to 'Rift DK2 Extend Display' - GameWindowMover.cs. UnityEditor GameView automatically move to 'Rift DK2 Extend Display' - GameWindowMover.cs. Skip to content. All gists Back to GitHub. Sign in Sign up. # elif UNITYSTANDALONEOSX // Mac settings (untested) private int. Aug 05, 2018 Debugging Unity Games. DnSpy can debug Unity debug builds and release builds. Release builds require a modified mono.dll / mono-2.0-bdwgc.dll file. It's also possible to turn a release build into a debug build. Debugging release builds. Make a backup copy of your game. You need a patched mono.dll / mono-2.0-bdwgc.dll file.

unity editor script: UnityEditor GameView automatically move to 'Rift DK2 Extend Display'
GameWindowMover.cs
usingUnityEngine;
usingUnityEditor;
//Version 0.21 | twitter:@izm update for DK2
//Version 0.2 | s.b.Newsom Edition
//Source from http://answers.unity3d.com/questions/179775/game-window-size-from-editor-window-in-editor-mode.html
//Modified by seieibob for use at the Virtual Environment and Multimodal Interaction Lab at the University of Maine.
//Use however you'd like!
//Modified by sbNewsom. Like it is said above, use as you like! If you're interested in my work, check out:
//http://www.sbnewsom.com
/// <summary>
/// Displays a popup window that undocks, repositions and resizes the game window according to
/// what is specified by the user in the popup. Offsets are applied to ensure screen borders are not shown.
/// </summary>
publicclassGameWindowMover: EditorWindow {
//The size of the toolbar above the game view, excluding the OS border.
privateinttabHeight=22;
privatebooltoggle=true;
//Get the size of the window borders. Changes depending on the OS.
#ifUNITY_STANDALONE_WIN
//Windows settings
privateintosBorderWidth=5;
#elifUNITY_STANDALONE_OSX
//Mac settings (untested)
privateintosBorderWidth=0; //OSX windows are borderless.
#else
//Linux / other platform; sizes change depending on the variant you're running
privateintosBorderWidth=5;
#endif
//default setting
privatestaticVector2_gameSize=newVector2(1530, 800);
privatestaticVector2_gamePosition=newVector2(2050, 50);
//Desired window resolution
publicVector2gameSize=newVector2(_gameSize.x,_gameSize.y);
//Desired window position
publicVector2gamePosition=newVector2(_gamePosition.x,_gamePosition.y);
//Tells the script to use the default resolution specified in the player settings.
privateboolusePlayerSettingsResolution=false;
//For those that duplicate screen
privatebooluseDesktopResolution=false;
//Shows the popup
[MenuItem ('Window/Rift VR Game Mode')]
staticvoidOpenPopup() {
GameWindowMoverwindow= (GameWindowMover)(EditorWindow.GetWindow(typeof(GameWindowMover)));
//Set popup window properties
Vector2popupSize=newVector2(300, 140);
//When minSize and maxSize are the same, no OS border is applied to the window.
window.minSize=popupSize;
window.maxSize=popupSize;
window.title='RiftMode';
window.ShowPopup();
}
//Returns the current game view as an EditorWindow object.
publicstaticEditorWindowGetMainGameView(){
//Creates a game window. Only works if there isn't one already.
EditorApplication.ExecuteMenuItem('Window/Game');
System.TypeT=System.Type.GetType('UnityEditor.GameView,UnityEditor');
System.Reflection.MethodInfoGetMainGameView=T.GetMethod('GetMainGameView',System.Reflection.BindingFlags.NonPublic|System.Reflection.BindingFlags.Static);
System.ObjectRes=GetMainGameView.Invoke(null,null);
return (EditorWindow)Res;
}
voidOnGUI(){
EditorGUILayout.Space();
if(useDesktopResolution){
gameSize=newVector2(Screen.currentResolution.width, Screen.currentResolution.height);
}
gameSize=EditorGUILayout.Vector2Field('Rift Display Size:', gameSize);
gamePosition=EditorGUILayout.Vector2Field('Rift Display Position:', gamePosition);
if(GUILayout.Button('Reset')){
gameSize=_gameSize;
gamePosition=_gamePosition;
}
GUILayout.Label('Rift Game Mode is now activated. ');
GUILayout.Label('Don't close this panel to keep script in effect.');
}
voidUpdate() {
if(Application.isPlaying){
MoveGameWindow();
toggle=true;
} else {
if(toggle){
CloseGameWindow();
toggle=false;
}
}
}
voidMoveGameWindow(){
EditorWindowgameView=GetMainGameView();
gameView.title='Game (Oculus Rift)';
//When minSize and maxSize are the same, no OS border is applied to the window.
gameView.minSize=newVector2(gameSize.x, gameSize.y+tabHeight-osBorderWidth);
gameView.maxSize=gameView.minSize;
RectnewPos=newRect(gamePosition.x, gamePosition.y-tabHeight, gameSize.x, gameSize.y+tabHeight-osBorderWidth);
gameView.position=newPos;
gameView.ShowPopup();
}
voidCloseGameWindow(){
EditorWindowgameView=GetMainGameView();
gameView.Close();
}
}
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

dnSpy can debug Unity debug builds and release builds. Release builds require a modified mono.dll / mono-2.0-bdwgc.dll file.

It's also possible to turn a release build into a debug build.

Debugging release builds

Buildsetting Gameview On Mac Unity Game

Make a backup copy of your game.

You need a patched mono.dll / mono-2.0-bdwgc.dll file. You can find 32-bit and 64-bit builds of Unity 4.x, 5.x, and 2017.x-2018.x on the releases page.

You need to know the Unity version that was used to build the game. To get the Unity version number, check the file properties of the <game>.exe or UnityPlayer.dll.

You also need to know if it's a 32-bit or a 64-bit game. If it's a 32-bit game, use the win32 directory, else if it's a 64-bit game, use the win64 directory.

Different Unity versions use different mono.dll filenames. Older Unity games use .NET 2.0-3.5 assemblies and use mono.dll, and newer Unity games that use .NET 4.x assemblies use mono-2.0-bdwgc.dll. This file is stored in different locations depending on Unity version:

  • <root><GAME>_DataMonomono.dll
  • <root><GAME>_DataMonoEmbedRuntimemono.dll
  • <root><GAME>_DataMonoBleedingEdgeEmbedRuntimemono-2.0-bdwgc.dll
  • <root>MonoEmbedRuntimemono.dll
  • <root>MonoBleedingEdgeEmbedRuntimemono-2.0-bdwgc.dll

Copy dnSpy's patched mono.dll / mono-2.0-bdwgc.dll file to the game, overwriting its file.

Now go to Debug -> Start Debugging and select Unity debug engine. If the game crashes you probably used the wrong version or you used a 32-bit file when the game is 64-bit or vice versa.

You can also choose Unity (Connect) if the game has already started. dnSpy's mono.dll will look for an environment variable called DNSPY_UNITY_DBG (Unity with .NET 2.0-3.5 assemblies) or DNSPY_UNITY_DBG2 (Unity with .NET 4.x assemblies)

  • DNSPY_UNITY_DBG:
    • --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555,defer=y or
    • --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555,defer=y,no-hide-debugger to enable detection of the debugger.
  • DNSPY_UNITY_DBG2:
    • --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555,suspend=n or
    • --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555,suspend=n,no-hide-debugger to enable detection of the debugger.

If the environment variable is missing, it will listen on port 55555.

If you want to compile mono.dll yourself, see https://github.com/0xd4d/dnSpy-Unity-mono

Debugging debug builds

  • Build a development build with script debugging enabled, or turn a release build into a debug build, see below
  • Run the game or press play in the Unity Editor
  • Start dnSpy and go to Debug -> Attach to Process (Unity)

NOTE: There's a 'step over' bug in Unity versions that use mono-2.0-bdwgc.dll. Use the patched mono-2.0-bdwgc.dll instead, it has the bug fix.

If you don't see the game in the dialog box, it's possible that the whole process is paused when it doesn't have keyboard focus. In that case, press Refresh in dnSpy and then quickly switch back to the game, and then back to dnSpy. If you still can't see it, wait until its intro is over and try again.

If you still don't see the game, then it's probably not a Unity game or a debug build.

Turning a release build into a debug build

Have a look at the exe's properties in Explorer. You should see the Unity version number.

Buildsetting Gameview On Mac Unity Game Of Thrones

Go to Unity download archive and download and install the correct version of Unity Editor. You'll find the windows players in <unity-install-dir>EditorDataPlaybackEngineswindowsstandalonesupportVariations.

Most likely you'll want the files in win32_development_mono since it's probably a 32-bit game.

Make a backup copy of your game. Copy the debug build Data directory to your games <name>_Data directory, overwriting everything in it.

  • Older Unity versions: copy player_win.exe and rename it to <game-name>.exe.
  • Newer Unity versions: Copy WindowsPlayer.exe + UnityPlayer.dll, and rename WindowsPlayer.exe to <game-name>.exe.

To enable script (.NET) debugging, you have to create a file in the <game-name>_Data directory.

If it's Unity 4.x - 5.x or Unity 2017.1:

<game-name>_DataPlayerConnectionConfigFile

Example:

Or if it's Unity 2017.2 or later

Buildsetting Gameview On Mac Unity Game

<game-name>_Databoot.config

Example:

It seems like only player-connection-debug=1 is needed, the other lines can be removed.