Search Unity

Build for Win Server 2008 R2 build script (BuildPlayer) / Failed to initialize Direct3D.

Discussion in 'Multiplayer' started by Krause-Biagosch, Jul 26, 2017.

  1. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    HI
    i create my Unity Server it works good on my Laptop. Now i want it to put it on the Win Server 2008 R2 and i build it as build script (BuildPlayer) and put it in the \Assets\Editor
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. public class NET_MyEditorScript: MonoBehaviour {
    5.     // Use this for initialization
    6.     void Start(){}
    7.  
    8.     // Update is called once per frame
    9.     void Update(){}
    10.  
    11.     public static void MyStart() {
    12.         string[] scenes = { "Assets/Scene/My_RE_Video_Test(SERVER).unity" };
    13.         BuildPipeline.BuildPlayer( scenes, "MyServer11.exe", BuildTarget.StandaloneWindows64, BuildOptions.None);
    14.     }
    15. }
    and start with the consol as admin with
    Code (csharp):
    1. C:/Unity/Editor/Unity.exe
    2. -projectPath C:/Users/ign/Desktop/My_Project_Work/Remote_Experte
    3. -logFile C:/Users/ign/Desktop/My_Project_Work/Remote_Experte/Log/ausgabe.txt
    4. -quit
    5. -batchmode
    6. -nographics
    7. -executeMethod NET_MyEditorScript.MyStart
    its create a build for "the server". If i put it on the Win Server 2008 R2 (without Graficcard / DirectX install) and start it i have this Error:

    Faild to initialize player

    Failed to initialize Direct3D.
    Make sure you have at least DirectX 9.0c installed, have drivers for your
    graphics card and have not disabled 3D acceleration in display settings.
    InitializeEngineGraphics failed

    How i can solve this problem, i set at build parameter -nographics ?? Why i have this error?
     
  2. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    no one have no ideas what is the problem?
     
  3. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Same results if you build from the editor?
     
  4. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    yes it's the same
    build with the editor i can't turn off nografics, because that i create a build script to turn off it for the run on the server

    but it don't work right
     
  5. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Why can't you turn off graphics? try to build the exe from the editor. Then open CMD on your remote machine and run exeName.exe -nographics -batchmode. If that doesn't work, try the same in a empty project. And if that doesn't work. Unity is probably to blame, put up a bug report.
     
    Krause-Biagosch likes this.
  6. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    ohh yeeess BIG THX
    over this way its works :D

    but at the moment i see over the task-manger that it's running

    i had simple debug gui that show me the status over the server, server start, client connect, client disconnect ...
    how can i set this messages in the cmd? it's possible?

    Code (CSharp):
    1. #region log debug
    2.     private void OnGUI()
    3.     {
    4.         //draws the debug console (or the show button in the corner to open it)
    5.         DebugHelper.DrawConsole();
    6.     }
    7.  
    8.     protected virtual void Init()
    9.     {
    10.  
    11.         if (uDebugConsole)
    12.             DebugHelper.ActivateConsole();
    13.         if (uLog)
    14.         {
    15.             if (sLogSet == false)
    16.             {
    17.                 SLog.SetLogger(OnLog);
    18.                 sLogSet = true;
    19.                 SLog.L("Log active");
    20.             }
    21.         }
    22.  
    23.         //This can be used to get the native webrtc log but causes a huge slowdown
    24.         //only use if not webgl
    25.         bool nativeWebrtcLog = false;
    26.  
    27.         if (nativeWebrtcLog)
    28.         {
    29. #if UNITY_ANDROID
    30.             //due to BUG0008 the callbacks in android doesn't work yet. use logcat instead of unity log
    31.             Byn.Net.Native.NativeWebRtcNetworkFactory.SetNativeDebugLog(WebRtcCSharp.LoggingSeverity.LS_INFO);
    32. #elif (!UNITY_WEBGL || UNITY_EDITOR)
    33.             Byn.Net.Native.NativeWebRtcNetworkFactory.LogNative(WebRtcCSharp.LoggingSeverity.LS_INFO);
    34. #else
    35.             //webgl. logging isn't supported here and has to be done via the browser.
    36.             Debug.LogWarning("Platform doesn't support native webrtc logging.");
    37. #endif
    38.         }            
    39.     }
    40.  
    41.     private static void OnLog(object msg, string[] tags)
    42.     {
    43.         StringBuilder builder = new StringBuilder();
    44.         bool warning = false;
    45.         bool error = false;
    46.         builder.Append("TAGS:[");
    47.         foreach (var v in tags)
    48.         {
    49.             builder.Append(v);
    50.             builder.Append(",");
    51.             if (v == SLog.TAG_ERROR || v == SLog.TAG_EXCEPTION)
    52.             {
    53.                 error = true;
    54.             }
    55.             else if (v == SLog.TAG_WARNING)
    56.             {
    57.                 warning = true;
    58.             }
    59.         }
    60.         builder.Append("]");
    61.         builder.Append(msg);
    62.         if (error)
    63.         {
    64.             LogError(builder.ToString());
    65.         }
    66.         else if (warning)
    67.         {
    68.             LogWarning(builder.ToString());
    69.         }
    70.         else
    71.         {
    72.             Log(builder.ToString());
    73.         }
    74.         Debug.Log(builder.ToString());
    75.     }
    76.  
    77.     private static void Log(string s)
    78.     {
    79.         if (s.Length > 2048 && Application.platform != RuntimePlatform.Android)
    80.         {
    81.             foreach (string splitMsg in SplitLongMsgs(s))
    82.             {
    83.                 Debug.Log(splitMsg);
    84.             }
    85.         }
    86.         else
    87.         {
    88.             Debug.Log(s);
    89.         }
    90.     }
    91.  
    92.     private static void LogWarning(string s)
    93.     {
    94.         if (s.Length > 2048 && Application.platform != RuntimePlatform.Android)
    95.         {
    96.             foreach (string splitMsg in SplitLongMsgs(s))
    97.             {
    98.                 Debug.LogWarning(splitMsg);
    99.             }
    100.         }
    101.         else
    102.         {
    103.             Debug.LogWarning(s);
    104.         }
    105.     }
    106.  
    107.     private static void LogError(string s)
    108.     {
    109.         if (s.Length > 2048 && Application.platform != RuntimePlatform.Android)
    110.         {
    111.             foreach (string splitMsg in SplitLongMsgs(s))
    112.             {
    113.                 Debug.LogError(splitMsg);
    114.             }
    115.         }
    116.         else
    117.         {
    118.             Debug.LogError(s);
    119.         }
    120.     }
    121.  
    122.     private static string[] SplitLongMsgs(string s)
    123.     {
    124.         const int maxLength = 2048;
    125.         int count = s.Length / maxLength + 1;
    126.         string[] messages = new string[count];
    127.         for (int i = 0; i < count; i++)
    128.         {
    129.             int start = i * maxLength;
    130.             int length = s.Length - start;
    131.             if (length > maxLength)
    132.                 length = maxLength;
    133.             messages[i] = "[" + (i + 1) + "/" + count + "]" + s.Substring(start, length);
    134.  
    135.         }
    136.         return messages;
    137.     }
    138. #endregion log debug
     
    Last edited: Jul 27, 2017
  7. Deleted User

    Deleted User

    Guest

    https://www.assetstore.unity3d.com/en/#!/content/49385
     
    Krause-Biagosch likes this.
  8. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    thx Wobes looks nice that what i need
    now i must put in my project
     
    Deleted User likes this.
  9. Deleted User

    Deleted User

    Guest

    You're welcome)