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

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

using UnityEngine;
using UnityEditor;

public class NET_MyEditorScript: MonoBehaviour {
    // Use this for initialization
    void Start(){}

    // Update is called once per frame
    void Update(){}

    public static void MyStart() {
        string[] scenes = { "Assets/Scene/My_RE_Video_Test(SERVER).unity" };
        BuildPipeline.BuildPlayer( scenes, "MyServer11.exe", BuildTarget.StandaloneWindows64, BuildOptions.None);
    }
}

and start with the consol as admin with

C:/Unity/Editor/Unity.exe
-projectPath C:/Users/ign/Desktop/My_Project_Work/Remote_Experte
-logFile C:/Users/ign/Desktop/My_Project_Work/Remote_Experte/Log/ausgabe.txt
-quit
-batchmode
-nographics
-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?

no one have no ideas what is the problem?

Same results if you build from the editor?

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

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.

1 Like

ohh yeeess BIG THX
over this way its works :smile:

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?

#region log debug
    private void OnGUI()
    {
        //draws the debug console (or the show button in the corner to open it)
        DebugHelper.DrawConsole();
    }

    protected virtual void Init()
    {

        if (uDebugConsole)
            DebugHelper.ActivateConsole();
        if (uLog)
        {
            if (sLogSet == false)
            {
                SLog.SetLogger(OnLog);
                sLogSet = true;
                SLog.L("Log active");
            }
        }

        //This can be used to get the native webrtc log but causes a huge slowdown
        //only use if not webgl
        bool nativeWebrtcLog = false;

        if (nativeWebrtcLog)
        {
#if UNITY_ANDROID
            //due to BUG0008 the callbacks in android doesn't work yet. use logcat instead of unity log
            Byn.Net.Native.NativeWebRtcNetworkFactory.SetNativeDebugLog(WebRtcCSharp.LoggingSeverity.LS_INFO);
#elif (!UNITY_WEBGL || UNITY_EDITOR)
            Byn.Net.Native.NativeWebRtcNetworkFactory.LogNative(WebRtcCSharp.LoggingSeverity.LS_INFO);
#else
            //webgl. logging isn't supported here and has to be done via the browser.
            Debug.LogWarning("Platform doesn't support native webrtc logging.");
#endif
        }            
    }

    private static void OnLog(object msg, string[] tags)
    {
        StringBuilder builder = new StringBuilder();
        bool warning = false;
        bool error = false;
        builder.Append("TAGS:[");
        foreach (var v in tags)
        {
            builder.Append(v);
            builder.Append(",");
            if (v == SLog.TAG_ERROR || v == SLog.TAG_EXCEPTION)
            {
                error = true;
            }
            else if (v == SLog.TAG_WARNING)
            {
                warning = true;
            }
        }
        builder.Append("]");
        builder.Append(msg);
        if (error)
        {
            LogError(builder.ToString());
        }
        else if (warning)
        {
            LogWarning(builder.ToString());
        }
        else
        {
            Log(builder.ToString());
        }
        Debug.Log(builder.ToString());
    }

    private static void Log(string s)
    {
        if (s.Length > 2048 && Application.platform != RuntimePlatform.Android)
        {
            foreach (string splitMsg in SplitLongMsgs(s))
            {
                Debug.Log(splitMsg);
            }
        }
        else
        {
            Debug.Log(s);
        }
    }

    private static void LogWarning(string s)
    {
        if (s.Length > 2048 && Application.platform != RuntimePlatform.Android)
        {
            foreach (string splitMsg in SplitLongMsgs(s))
            {
                Debug.LogWarning(splitMsg);
            }
        }
        else
        {
            Debug.LogWarning(s);
        }
    }

    private static void LogError(string s)
    {
        if (s.Length > 2048 && Application.platform != RuntimePlatform.Android)
        {
            foreach (string splitMsg in SplitLongMsgs(s))
            {
                Debug.LogError(splitMsg);
            }
        }
        else
        {
            Debug.LogError(s);
        }
    }

    private static string[] SplitLongMsgs(string s)
    {
        const int maxLength = 2048;
        int count = s.Length / maxLength + 1;
        string[] messages = new string[count];
        for (int i = 0; i < count; i++)
        {
            int start = i * maxLength;
            int length = s.Length - start;
            if (length > maxLength)
                length = maxLength;
            messages[i] = "[" + (i + 1) + "/" + count + "]" + s.Substring(start, length);

        }
        return messages;
    }
#endregion log debug

https://www.assetstore.unity3d.com/en/#!/content/49385

1 Like

thx Wobes looks nice that what i need
now i must put in my project

1 Like

You’re welcome)