// Use this for initialization
 void Start()
 {
     UseProjection = CommandLineParms.Bool("UseProjection", UseProjection); // allow the command line to override it
     if (UseProjection)
     {
         _cacheOmnity = ProjectionCamera.Attach(GetMainCamera());
     }
 }
    //////////////////////////////////////////////////////////////////////////

    private ForceSocket()
    {
        string wsurl = CommandLineParms.String("wsserver");

        if (wsurl != "")
        {
            _ws_url = wsurl;
        }
    }
예제 #3
0
    static public void Enforce()
    {
        // The target frame rate will try to hit what is passed, but it will typically float above that (ex: 120 is about 121 or 122, 500 is around 526, etc)
        // Setting this to -1 will turn this off and let you achieve stupidly-high frame rates in the thousands but will also drive the system pretty hard.
        // 120 fps == ~~ 8.2ms
        // 200 fps == ~~ 4.9ms
        // 300 fps == ~~ 3.2ms
        // 400 fps == ~~ 2.4ms
        // 500 fps == ~~ 1.9ms
        // 1000 fps == ~~0.9ms -> this appears to be the max, anything higher seems to top out here
        // 3200+ ~~ 0.3ms (only possible if targetFrameRate set to -1)

        QualitySettings.vSyncCount  = 0;                                      // disable locking to 60 or 30 hz; otherwise targetFrameRate is ignored
        Application.targetFrameRate = CommandLineParms.Int("framerate", 120); // can be overridden by passing -framerate NNN

        // We always want the protocol to run in the background; otherwise when the main app gets focus we stop
        Application.runInBackground = true;
    }
    /////////////////////////////////////////////

    private CrashReporter()
    {
        // if the ReportUrl is empty then try to pull the root server from the command line
        if (string.IsNullOrEmpty(ReportURL))
        {
            string serverRoot = CommandLineParms.String("server"); // this should be something like http://127.0.0.1:61710
            if (string.IsNullOrEmpty(serverRoot))
            {
                Debug.LogWarning("CrashReporter URL not set, reports will not be enabled.");
                return;
            }

            ReportURL = serverRoot += "/$playercrash";
            // the $playercrash handler parses and redirects to "http://bertec.com/_WBServices/unitycrashreport.php"
        }

        Application.logMessageReceivedThreaded += HandleLog;
    }
    static public void Fix()
    {
        // Check if the program was launched with an embedded window parm
        if (CommandLineParms.isSet("parentHWND"))
        {
            int dispNum = PlayerPrefs.GetInt("UnitySelectMonitor");

            if (dispNum != 0)
            {
                Debug.Log("App launched as embedded window with a non-primary display, forcing display size and position back to primary");

                int screenWidth  = Screen.width;
                int screenHeight = Screen.height;

                // We can reset this back to zero which will skip running this code next time, but it doesn't appear to cause any problems to leave it alone.
                //PlayerPrefs.SetInt("UnitySelectMonitor", 0); // Select monitor 1

                Display.displays[0].Activate(screenWidth, screenHeight, 0);
                Display.displays[0].SetParams(screenWidth, screenHeight, 0, 0);
            }
        }
    }