Unity3d full screen and cross-screen (dual screen) scenarios in Windows

Source: Internet
Author: User

Scenario 1 2 camera scenes in unity are displayed on two monitor screens (one window across the screen)

1. Set up two cameras in a scene

Camera 1

Camera 2

2. Set the platform and resolution of the release

3. Full-screen running game, no title bar can also through-popupwindow

For example:

G:\untiy3d_workspace\demos>lol_demo_0515-popupwindow

Scenario 2

http://blog.csdn.net/a117653909/article/details/47101743

Environment: Win7 64bit, Unity3d 4.6.2

Using System;Using System.Collections;Using System.Runtime.InteropServices;Using System.Diagnostics;Using Unityengine;Using System.Xml.Serialization;PublicClass windowmod:monobehaviour{[Hideininspector]Public Rect screenposition; [DllImport ("User32.dll")]Staticextern IntPtr SetWindowLong (INTPTR hwnd,int _nindex,int dwnewlong); [DllImport ("User32.dll")]StaticexternBOOL SetWindowPos (IntPtr hWnd,int Hwndinsertafter,int X,int Y,int CX,int CY,UINT uflags); [DllImport ("User32.dll")]Staticextern IntPtr GetActiveWindow ();ConstUINT Swp_showwindow =0x0040Constint Gwl_style =-16;Constint ws_border =1;Privateint i =0; void Start () {SetWindowLong (GetActiveWindow (), Gwl_style, Ws_border); SetWindowPos (GetActiveWindow (),-1, (int) screenPosition.x, ( int) screenposition.y, (int) screenposition.width, (int) screenposition.height, Swp_showwindow); } void Update () {i++; if (I<5) {SetWindowLong (GetActiveWindow (), GWL_STYLE, WS_ BORDER); SetWindowPos (GetActiveWindow (),-1, (int) screenPosition.x, ( int) screenposition.y, (int) screenposition.width, (int) screenposition.height, Swp_showwindow); } }}


, build settings
With this script, you can make the Unity3d window full screen, no title bar, by changing the value of Screenposition, you can also make the window directly on the second screen start (x=0, y=0, width=1920, height=1080), or window across two screens (x= 0, Y=0, width=3840, height=1080).
The Windows System records the window size and location of each software, records the \HKEY_CURRENT_USER\SOFTWARE\XXX\YYY location in the registry, XXX is the company Name Unity3d in the build setting, YYY is the product Name in the build setting. So if there are problems with the window size, you can back up the registry and then delete the XXX entries. It is recommended that you do not use the default value for the product name of each project, otherwise the packaged software will correspond to the same items in the registration table.

Unity3d full screen and cross-screen (dual screen) scenarios in Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.