Standalone Player command line argument "-adapter" syntax - syntax

I need to select the monitor my game is displayed on from the command line for dual monitor systems. If I use the Unity Screen Selector Dialog it gives me the choice of which monitor I want to display the game on when starting the game, and it works fine. When I try loading the game from the command line with the command line argument: "MyGame -adapter 1" or "MyGame -adapter 2" it seems to ignore the argument, and just loads the game on the same monitor every time.
Notes:
I have a dual monitor system, but only one video card (GeForce GT 740).
I am using Unity 5.6.1f1 (64-bit), and Window 10.
Please let me know what I am missing.

This is a known bug and it doesn't seem to be fixed at this time. The -adapter argument does not work with any Direct3D above 9.
Go to File --> Build Settings, select your PC Windows platform then go to Other Settings.
From here, disable the Auto Graphics API for Windows checkbox.
You will be given option to chose which Direct3D to use. Make to remove all other Direct3D version and simply just put Direct3D9 there. The 9th version should until Unity fixes this bug.
If that does not work:
Go to File --> Build Settings, select your PC Windows platform then go to Resolution and Presentation.
Disable "Default Is Full Screen" and "Display Resolution Dialog".
Again, if that fails, use the Display API to do through code. You can find more information about that here. I also suggest that you file for a bug report too.

Related

ARCore unity debugging

For example I try to print out to the console and it doesn't, my script is attached to my main camera so we can rule that out and yes the script is active also, any help will be appreciated, right now what I am working on is to click on a certain part of my GameObject in AR and while my phone is connected to the computer I want to see the name of the certain part I clicked on in the console.
When you run the app on and Android device the log does not go to the Unity editor console. In order to see it you need to open Android Studio and then use the Logcat tab to see the device log.
Alternatively, you can run logcat from the command line
adb logcat.
More information: https://developer.android.com/studio/command-line/logcat.html
I have worked with ARCore and had the same frustating experience when it comes to debugging.
If you just want console prints, then use Log viewer which can catch and show them on Android too. (https://assetstore.unity.com/packages/tools/log-viewer-12047)
However, because I wanted more control and the ability to test and debug my game logic right inside the editor (without deploying to the phone all the time), I wrote a little plugin that allows me to do just that. This plugin simulates the operation of ARCore inside Unity editor. You can just hit play and ARCore will be simulated for you, so you can freely develop and debug your game logic. Moreover, you can then just build and deploy the project without changing anything, and ARCore will work like normal on your phone.
Using it is very similar to native ARCore, so you will not have much difficulty getting into it. It does not cover ALL features of ARCore yet, but it covers the basics. You can still use native ARCore for the rest.
You can find it here: https://github.com/VR-House/Eazy-ARCore-Interface
In current versions of Unity you can output logs from connected devices to Unity Editor. To do this, build your project in Development Mode and connect the Console to your device.
But I would recommend a more advanced way of testing AR in Editor with a plugin I wrote. I wrote it for my project and decided to make it into a plugin so everyone else can benefit from it.
AR Foundation Editor Remote plugin:
https://forum.unity.com/threads/ar-foundation-editor-remote-test-and-debug-your-ar-project-in-the-editor.898433/
I use debugging like this in C# script:
Debug.Log("Debug message and image name "+Image.Name);
To see this real time, I use Android Device Monitor (it's in Android's sdk folder, usually \Users\AppData\Local\Android\sdk\tools\monitor.bat. If device is connected, it appears on the devices list and it can be selected.
Or if I want to see the debug log in device, I put these lines in script:
private void OnGUI()
{
GUIStyle style = new GUIStyle();
style.fontSize = 50;
GUI.Box(new Rect(350, 0, 500, 500), Image.Name, style);
}
The Rect(350,0 is the position, 500,500 is the width and height of rectangle.

SStab not appearing correctly in different OS's

I'm working on a legacy VB6 application in Windows 10. I'm currently trying to get the application to run seamlessly in Windows 10 and I'm coming across some issues. One of them is the SSTab control. See Image below:
Style, Tab Orientation, All the properties are identical, but as can be seen the text in Windows 7 looks proper vs Win 10. It seems to float left and when selected, one of the S's seems to get cut off the top and added in the 2nd line.
Anyone have any idea?
Try choosing Win 7 in the version part of compatibility. There is the App Compat Kit from MS that allows you to set thousands of compat settings rather than just a few common ones in that compatibility dialog https://www.microsoft.com/en-au/download/details.aspx?id=7352

Integrate Windows 8 program with windows search

I want to know if it is possible to have data from my Windows 8 program be able to show up in windows search. For instance, the user could search for "myprogramdata1" in windows and then an item would show up that when clicked would open up my program and I'd be able know that "myprogramdata1" was selected.
EDIT:
I know that it is possible for windows 10. For the program DisplayFusion, if I search settings, there is a result for DisplayFusion settings that can be clicked on and will bring me to the settings page for the program. Does anyone know how this is done?
First of see if you say the command that you typed in using cortana and if it opens settings. If yes, You can absolutely do it.
I did it for one of my app too( Well this was not my intention but it works )
UWP Samples-CortanaVoiceCommand
The key here is once Voice Commands are installed, you can type the text in cortana search (instead of actual voice command) and it works the same. You can still use patterns of voice commands and still type in Cortana search and open your app.

How to change 3rd monitor programmatically

When I'm using my laptop, I use 3 displays:
The laptop display
A second monitor (connected through VGA)
A TV (connected through HDMI)
My videocard doesn't support 3 monitors, so I'm constantly switching from 2 to 3: when I'm on the computer, I use the 2nd monitor, and when I want to watch some movies, etc. I use the 3rd.
I currently have to go to Screen Resolution, select the monitor that is not in use, and choose Extend desktop to this display.
Is there a way I can automate it?
Is there any command-line tool, or any Windows API that allows doing it?
Edit:
Display Changer seems to do what I need, but the problem is that it only detects the working monitors. The 3rd monitor (which isn't currently in use) isn't detected, so I can't attach it.
A bit of RE on DisplaySwitch.exe shows that it calls
SetDisplayConfig(0, NULL, NULL, NULL, 0x888)
to set it to Extended on my computer.
From there, a little digging around got me to the SetDisplayConfig documentation obviously and also this SO page with some example code that queries your current display state and adds the actual flags to change them if you want to do so.
I answered a similar question with suggestion to try UltraMon or use their SDK, but you can also hit the Win32 API directly with ChangeDisplaySettingsEx. Another user, Sai, gave an reference to an example showing use of the function.

prevent sleep mode and automatic update/shutdown - windows 7

I need to run a program - probably for a couple of days.
I am just wondering how I can prevent windows 7 to go into sleep mode/hibernate and prevent automatic update.
Thanks.
Christian
As for preventing sleep/hibernate try to look in MSDN at SetThreadExecutionState, WM_POWERBROADCAST. Read also the following document.
Or you can just right click on the power icon near the clock, or type power in the Start Menu and select power options. Next choose one of the currnet power plan your computer is set to, and click on the Change plan settings. Simply set ALL the parameter to Never... you computer will run forever...
There are two great sample chapters on Windows Phone and Silverlight for Windows Phone on the LearningWindosPhone.com site. There is great Windows Phone Trainng material , and dont forget the Windows Phone Develoeprs Blog

Resources