Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Dedicated Server Build - Screen Size

Discussion in 'Multiplayer' started by CDF, May 26, 2022.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,229
    Hey, when running unity in headless mode using the new dedicated server build target, I'm wondering where Unity is getting the screen size value from?

    screensize.png

    Code (CSharp):
    1. public class ApplicationLoader : MonoBehaviour {
    2.  
    3.     private void Start() {
    4.  
    5.         Debug.Log("Starting Dedicated Server");
    6.         Debug.Log($"Screen width: {Screen.width}, Screen height: {Screen.height}");
    7.         Debug.Log($"Screen dpi: {Screen.dpi}");
    8.         Debug.Log($"Current resolution: {Screen.currentResolution}");
    9.         Debug.Log($"Fullscreen: {Screen.fullScreen}");
    10.         Debug.Log($"Fullscreen mode: {Screen.fullScreenMode}");
    11.  
    12.         foreach (var resolution in Screen.resolutions) {
    13.  
    14.             Debug.Log($"\tresolution: {resolution}");
    15.         }
    16.     }
    17. }
    I was not expecting the Screen to have any size when running in headless mode. Kind of surprised by it.

    Would just like to know what defines this?

    I'm running this directly from my Windows PC.
     
    Last edited: May 27, 2022