private void LogResult(string testName, double native, double managed, int n, int sampleSize)
 {
     UnityEngine.Debug.Log(
         String.Format("Test [{0}]: Managed must run at most {1} times slower than native to pass. (Native = {2} ms, Managed = {3} ms, SampleSize = {4}, UnityVersion = {5})",
                       testName, n, native, managed, sampleSize, InternalEditorUtility.GetFullUnityVersion())
         );
 }
示例#2
0
        private static string GetEmailURL(Exception e = null)
        {
            var full = new StringBuilder();
            var body = new StringBuilder();

            #if UNITY_2018_1_OR_NEWER
            Func <string, string> EscapeURL = url => UnityEngine.Networking.UnityWebRequest.EscapeURL(url).Replace("+", "%20");
            #else
            Func <string, string> EscapeURL = url => WWW.EscapeURL(url).Replace("+", "%20");
            #endif

            body.Append("\nDescribe your issue or make your request here");
            body.Append("\n\nAdditional Information:");
            body.AppendFormat("\nVersion: {0}", pluginVersion.ToString(3));
            body.AppendFormat("\nUnity {0}", InternalEditorUtility.GetFullUnityVersion());
            body.AppendFormat("\n{0}", SystemInfo.operatingSystem);

            if (e != null)
            {
                body.AppendFormat("\n\nEXCEPTION\n", e);
            }

            full.Append("mailto:");
            full.Append(DEVELOPER_EMAIL);
            full.Append("?subject=");
            full.Append(EscapeURL("Fullscreen Editor - Support"));
            full.Append("&body=");
            full.Append(EscapeURL(body.ToString()));

            return(full.ToString());
        }
示例#3
0
        private static string GetEmailURL(Exception e)
        {
            var full = new StringBuilder();
            var body = new StringBuilder();

            #if UNITY_2018_1_OR_NEWER
            Func <string, string> EscapeURL = url => { return(UnityEngine.Networking.UnityWebRequest.EscapeURL(url).Replace("+", "%20")); };
            #else
            Func <string, string> EscapeURL = url => { return(WWW.EscapeURL(url).Replace("+", "%20")); };
            #endif

            body.Append(EscapeURL("\r\nDescribe your problem or make your request here\r\n"));
            body.Append(EscapeURL("\r\nAdditional Information:"));
            body.Append(EscapeURL("\r\nVersion: " + pluginVersion.ToString(3)));
            body.Append(EscapeURL("\r\nUnity " + InternalEditorUtility.GetFullUnityVersion()));
            body.Append(EscapeURL("\r\n" + SystemInfo.operatingSystem));

            if (e != null)
            {
                body.Append(EscapeURL("\r\n" + e));
            }

            full.Append("mailto:");
            full.Append(DEVELOPER_EMAIL);
            full.Append("?subject=");
            full.Append(EscapeURL("Enhanced Hierarchy - Support"));
            full.Append("&body=");
            full.Append(body);

            return(full.ToString());
        }
    public void getEditorPref()
    {
        string version = InternalEditorUtility.GetFullUnityVersion();

        version          = version.Substring(0, version.LastIndexOf('.'));
        originalFilename = "";
        orient           = EditorPrefs.GetBool("PiXYZ.Orient", false);
        mapUV            = EditorPrefs.GetBool("PiXYZ.MapUV", false);
        mapUV3dSize      = EditorPrefs.GetFloat("PiXYZ.MapUV3dSize", 100.0f);
        scaleFactor      = EditorPrefs.GetFloat("PiXYZ.ScaleFactor", 0.001f);
        isRightHanded    = EditorPrefs.GetBool("PiXYZ.IsRightHanded", true);
        isZUp            = EditorPrefs.GetBool("PiXYZ.IsZUp", true);
        treeProcess      = (TreeProcessType)EditorPrefs.GetInt("PiXYZ.TreeProcess", 0);
        lodCurrentIndex  = EditorPrefs.GetInt("PiXYZ.LODCurrentIndex", 0);
        lodSettingCount  = EditorPrefs.GetInt("PiXYZ.LODSettingCount", 1);
        useLods          = EditorPrefs.GetBool("PiXYZ.UseLods", false);
        lodsMode         = (LODsMode)EditorPrefs.GetInt("PiXYZ.LODsMode", 2);
        lodSettings      = new List <PiXYZLODSettings>();
        for (int i = 0; i < lodSettingCount; ++i)
        {
            PiXYZLoDSettingsEditor lod = new PiXYZLoDSettingsEditor();
            lod.index = i;
            lod.getEditorPref();
            lodSettings.Add(lod);
        }
        splitTo16BytesIndex     = EditorPrefs.GetBool("PiXYZ.SplitTo16BytesIndex", false);
        useMergeFinalAssemblies = EditorPrefs.GetBool("PiXYZ.UseMergeFinalAssemblies", false);
    }
示例#5
0
        public static string GetUnityHubModuleDownloadURL(string moduleName)
        {
            var fullVersion  = InternalEditorUtility.GetFullUnityVersion();
            var revision     = "";
            var shortVersion = "";
            var versionMatch = s_VersionPattern.Match(fullVersion);

            if (!versionMatch.Success || !versionMatch.Groups["shortVersion"].Success || !versionMatch.Groups["suffix"].Success)
            {
                Debug.LogWarningFormat("Error parsing version '{0}'", fullVersion);
            }

            if (versionMatch.Groups["shortVersion"].Success)
            {
                shortVersion = versionMatch.Groups["shortVersion"].Value;
            }

            if (versionMatch.Groups["revision"].Success)
            {
                revision = versionMatch.Groups["revision"].Value;
            }

            if (s_ModuleNames.ContainsKey(moduleName))
            {
                moduleName = s_ModuleNames[moduleName];
            }

            return($"unityhub://{shortVersion}/{revision}/module={moduleName.ToLower()}");
        }
        static public string GetPlaybackEngineDownloadURL(string moduleName)
        {
            if (moduleName == "PS4" || moduleName == "XboxOne")
            {
                return("https://unity3d.com/platform-installation");
            }

            string fullVersion  = InternalEditorUtility.GetFullUnityVersion();
            string revision     = "";
            string shortVersion = "";
            Match  versionMatch = s_VersionPattern.Match(fullVersion);

            if (!versionMatch.Success || !versionMatch.Groups["shortVersion"].Success || !versionMatch.Groups["suffix"].Success)
            {
                Debug.LogWarningFormat("Error parsing version '{0}'", fullVersion);
            }

            if (versionMatch.Groups["shortVersion"].Success)
            {
                shortVersion = versionMatch.Groups["shortVersion"].Value;
            }
            if (versionMatch.Groups["revision"].Success)
            {
                revision = versionMatch.Groups["revision"].Value;
            }

            if (s_ModuleNames.ContainsKey(moduleName))
            {
                moduleName = s_ModuleNames[moduleName];
            }

            string prefix    = "download";
            string suffix    = "download_unity";
            string folder    = "Unknown";
            string extension = string.Empty;

            if (versionMatch.Groups["alphabeta"].Success)
            {
                // These releases are hosted on the beta site
                prefix = "beta";
                suffix = "download";
            }

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                folder    = "TargetSupportInstaller";
                extension = ".exe";
            }
            else if (Application.platform == RuntimePlatform.OSXEditor)
            {
                folder    = "MacEditorTargetInstaller";
                extension = ".pkg";
            }

            return(string.Format("http://{0}.unity3d.com/{1}/{2}/{3}/UnitySetup-{4}-Support-for-Editor-{5}{6}", prefix, suffix, revision, folder, moduleName, shortVersion, extension));
        }
    static CheckEditorVersion()
    {
        var skip = EditorPrefs.GetString(SkipKey()) == m_desiredVersion;

        var fullUnityVersion = InternalEditorUtility.GetFullUnityVersion();

        if (!skip && !fullUnityVersion.StartsWith(m_desiredVersion))
        {
            ShowWindow();
        }
    }
示例#8
0
        /// <summary>
        /// Iterates over array of specified records and generates report.
        /// </summary>
        /// <param name="module">Module name.</param>
        /// <param name="records">Array of records to iterate.</param>
        /// <param name="optionalHeader">Optional string to add as a report header.</param>
        /// <param name="optionalFooter">Optional string to add as a report footer.</param>
        /// <returns>Final report string.</returns>
        public static string GenerateReport <T>(string module, T[] records, string optionalHeader = null, string optionalFooter = null) where T : RecordBase
        {
            reportStringBuilder.Length = 0;

            string isPro = null;

            if (Application.HasProLicense())
            {
                isPro = " Professional";
            }

            reportStringBuilder.
            AppendLine("////////////////////////////////////////////////////////////////////////////////").
            Append("// ").Append(module).AppendLine(" report").
            Append("// ").AppendLine(Application.dataPath.Remove(Application.dataPath.LastIndexOf("/", StringComparison.Ordinal), 7)).
            AppendLine("////////////////////////////////////////////////////////////////////////////////").
            Append("// Maintainer ").AppendLine(Maintainer.Version).
            Append("// Unity ").Append(InternalEditorUtility.GetFullUnityVersion()).AppendLine(isPro).
            AppendLine("//").
            AppendLine("// Homepage: http://codestage.net/uas/maintainer").
            AppendLine("// Contacts: http://codestage.net/contacts").
            AppendLine("////////////////////////////////////////////////////////////////////////////////");

            if (records != null && records.Length > 0)
            {
                if (!string.IsNullOrEmpty(optionalHeader))
                {
                    reportStringBuilder.AppendLine(optionalHeader);
                }

                foreach (var record in records)
                {
                    reportStringBuilder.AppendLine("---").AppendLine(record.ToString(true));
                }

                if (!string.IsNullOrEmpty(optionalFooter))
                {
                    reportStringBuilder.AppendLine("---").AppendLine(optionalFooter);
                }
            }
            else
            {
                reportStringBuilder.AppendLine("No records to report.");
            }

            return(reportStringBuilder.ToString());
        }
示例#9
0
        /// <summary>
        /// Sends a new analytic event to the server.
        /// </summary>
        /// <param name="hitType">The type of event we have</param>
        /// <param name="category">The category</param>
        /// <param name="action">The action key</param>
        /// <param name="label">the label on the action</param>
        /// <param name="value">The value of the action</param>
        public static void Send(Dictionary <string, string> postData, HitType hitType)
        {
            postData["t"]   = hitType.ToString().ToLower();                // Hit Type
            postData["v"]   = AnalyticsConstants.PROTOCOL_VERSION;         // Protocol Version
            postData["tid"] = AnalyticsConstants.TRACKING_ID;              // Tracking ID
            postData["ds"]  = InternalEditorUtility.GetFullUnityVersion(); // DataSource
            postData["cid"] = GetClientID();                               // Client ID
            postData["uid"] = GetUserID();                                 // User ID
            postData["av"]  = WeaverSettings.VERSION;                      // Application Version
            postData["ul"]  = CultureInfo.CurrentCulture.Name;             // User Language
            postData["an"]  = "Weaver";                                    // Application Name

            // Create our request
            UnityWebRequest www = UnityWebRequest.Post(AnalyticsConstants.URL, postData);

            // Send the even t
            www.SendWebRequest();
        }
示例#10
0
        public static BuildMetadata CreateBuildMetadata()
        {
            var meta = ScriptableObject.CreateInstance <BuildMetadata>();
            var git  = Gits.GetFromCurrentDirectory();

            meta.HasChangesInWorkingCopy = git.WorkingCopy.HasChanges;
            meta.BranchName       = git.Branch.Name;
            meta.CommitHash       = git.Commit.Hash;
            meta.CommitShortHash  = git.Commit.ShortHash;
            meta.GitCommitHubHash = git.Commit.GitHubHash;
            meta.CommitMessage    = git.Commit.Message;
            meta.SetCommitTime(git.Commit.UnixTimestamp);
            meta.SetBuildTime(DateTime.Now.Ticks);

            meta.MachineName      = SystemInfo.deviceName;
            meta.FullUnityVersion = InternalEditorUtility.GetFullUnityVersion();
            return(meta);
        }
        private static string GetEmailURL()
        {
            var full = new StringBuilder();
            var body = new StringBuilder();

            body.Append(EscapeURL("\r\nDescribe your problem or make your request here\r\n"));
            body.Append(EscapeURL("\r\nAdditional Information:"));
            body.Append(EscapeURL("\r\nVersion: " + pluginVersion.ToString(3)));
            body.Append(EscapeURL("\r\nUnity " + InternalEditorUtility.GetFullUnityVersion()));
            body.Append(EscapeURL("\r\n" + SystemInfo.operatingSystem));

            full.Append("mailto:");
            full.Append(DEVELOPER_EMAIL);
            full.Append("?subject=");
            full.Append(EscapeURL("Fullscreen Editor - Support"));
            full.Append("&body=");
            full.Append(body);

            return(full.ToString());
        }
示例#12
0
        private static string GetEmailURL()
        {
            var full = new StringBuilder();
            var body = new StringBuilder();

            Func <string, string> EscapeURL = url => { return(WWW.EscapeURL(url).Replace("+", "%20")); };

            body.Append(EscapeURL("\r\nDescribe your problem or make your request here\r\n"));
            body.Append(EscapeURL("\r\nAdditional Information:"));
            body.Append(EscapeURL("\r\nVersion: " + pluginVersion.ToString(3)));
            body.Append(EscapeURL("\r\nUnity " + InternalEditorUtility.GetFullUnityVersion()));
            body.Append(EscapeURL("\r\n" + SystemInfo.operatingSystem));

            full.Append("mailto:");
            full.Append(DEVELOPER_EMAIL);
            full.Append("?subject=");
            full.Append(EscapeURL("Enhanced Hierarchy - Support"));
            full.Append("&body=");
            full.Append(body);

            return(full.ToString());
        }
        private static string getScriptPath()
        {
            string version = InternalEditorUtility.GetFullUnityVersion().Split(' ')[0];

#if UNITY_EDITOR_WIN
            string path = string.Format(s_windowsScriptPathHub, version, s_csharpScriptFileName);
            if (Directory.Exists(path))
            {
                return(path);
            }
            else if (Directory.Exists(s_windowsScriptPath))
            {
                return(s_windowsScriptPath);
            }
#elif UNITY_EDITOR_OSX
            Debug.LogError("This code is untested!! Script path might be wrong for OSX, especially when installed using Unity Hub.");
            if (Directory.Exists(s_osxScriptPath))
            {
                return(s_osxScriptPath);
            }
#endif
            throw new NotImplementedException();
        }
    public void OnGUI()
    {
        GUILayout.Label(
            "Project " + Application.productName + " requires unity version " + m_desiredVersion +
            ", you are currently on " + InternalEditorUtility.GetFullUnityVersion() + " please update",
            "WordWrappedLabel");

        GUILayout.Space(20f);

        if (GUILayout.Button("Download new version"))
        {
#if  UNITY_EDITOR_WIN
            Help.BrowseURL(m_desiredVersionWinURL);
#else
            Help.BrowseURL(m_desiredVersionOSXURL);
#endif
        }

        if (GUILayout.Button("Ignore"))
        {
            EditorPrefs.SetString(SkipKey(), m_desiredVersion);
        }
    }
示例#15
0
        /// <summary>
        /// Iterates over array of IssuesRecords and generates report.
        /// </summary>
        /// <param name="issues">Array of IssuesRecords to iterate.</param>
        /// <returns>Final report string.</returns>
        public static string GenerateReport(IssueRecord[] issues)
        {
            stringBuilder.Length = 0;

            string isPro = null;

            if (Application.HasProLicense())
            {
                isPro = " Professional";
            }

            stringBuilder.
            AppendLine("////////////////////////////////////////////////////////////////////////////////").
            AppendLine("// Issues Finder report").
            Append("// ").AppendLine(Application.dataPath.Remove(Application.dataPath.LastIndexOf("/", StringComparison.Ordinal), 7)).
            AppendLine("////////////////////////////////////////////////////////////////////////////////").
            Append("// Maintainer ").Append(Maintainer.VERSION).AppendLine(" Issues Finder report").
            Append("// Unity ").Append(InternalEditorUtility.GetFullUnityVersion()).AppendLine(isPro).
            AppendLine("//").
            AppendLine("// Homepage: http://blog.codestage.ru/unity-plugins/maintainer").
            AppendLine("// Contacts: http://blog.codestage.ru/contacts").
            AppendLine("////////////////////////////////////////////////////////////////////////////////");

            if (issues != null)
            {
                for (int i = 0; i < issues.Length; i++)
                {
                    stringBuilder.AppendLine("---").AppendLine(issues[i].ToString(true));
                }
            }
            else
            {
                stringBuilder.AppendLine("Issues array is null! This shouldn't happen, please report.");
            }
            return(stringBuilder.ToString());
        }
示例#16
0
    void printSettingsGUI(SerializedObject serializedObject, string prefix = PiXYZSettings.serializePrefix, string fileExt = "", GameObject gameObject = null)
    {
        serializedObject.Update();

        int  winId       = serializedObject.FindProperty("windowId").intValue;
        bool isInspector = serializedObject.FindProperty("isInspector") != null?serializedObject.FindProperty("isInspector").boolValue : false;

        string  tt = "";
        Vector2 scrollViewPosition;

        int focusId = EditorWindow.focusedWindow != null?EditorWindow.focusedWindow.GetInstanceID() : lastFocusedId;

        if (winId != focusId)
        {
            winId = 0;
        }
        if (!g_scrollViewPosition.ContainsKey(winId))   //winId = 0 is shared
        {
            scrollViewPosition          = new Vector2(0, 0);
            g_scrollViewPosition[winId] = scrollViewPosition;
        }
        else
        {
            scrollViewPosition = g_scrollViewPosition[winId];
        }
        if (!UvAnim.ContainsKey(winId) && winId != 0)
        {
            UvAnim[winId] = new AnimBool(false);
            UvAnim[winId].valueChanged.AddListener(EditorWindow.focusedWindow.Repaint);
        }
        if (!lodAnim.ContainsKey(winId) && winId != 0)
        {
            lodAnim[winId] = new AnimBool(false);
            lodAnim[winId].valueChanged.AddListener(EditorWindow.focusedWindow.Repaint);
        }
        if (!advancedToggle.ContainsKey(winId))
        {
            advancedToggle[winId] = false;
        }

        SerializedProperty serializedProperty = serializedObject.FindProperty(prefix);

        int lastShown = 0;

        scrollViewPosition = GUILayout.BeginScrollView(scrollViewPosition, GUILayout.MaxHeight(Screen.height - 30));
        {
            g_scrollViewPosition[winId] = scrollViewPosition;
            EditorGUI.indentLevel       = 0;
            EditorGUILayout.BeginVertical();
            {
                GUILayout.Space(10);
                tt = "Use the following settings to adapt the imported model’s units/transforms to Unity3D’s units/coordinate system (meters/left-handed).\n\nDefault settings change a millimeters / Z-up axis scene to Unity configuration.";
                beginGroupBox("Coordinate System", isInspector, tt);
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.BeginHorizontal();
                    {
                        tt = PiXYZUtils.getTooltipText <PiXYZSettings>("scaleFactor");
                        EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("scaleFactor"), new GUIContent("Scale", tt));
                        GUILayout.Space(10);
                    }
                    EditorGUILayout.EndHorizontal();
                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("isRightHanded");
                    EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("isRightHanded"), new GUIContent("Right Handed", tt));
                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("isZUp");
                    EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("isZUp"), new GUIContent("Z-up", tt));
                    EditorGUILayout.Space();
                }
                endGroupBox();

                if (!isPiXYZExt(fileExt))
                {
                    GUILayout.Space(10);
                    tt = "Choose one of the following mode to optimize the imported model’s hierarchy (or tree)\n\n\nNone: No modification of the hierarchy (default mode)\n\nClean-up intermediary nodes: Compresses the hierarchy by removing empty nodes, or any node containing only one sub-node.\n\nTransfer all objects under root: Simplifies the hierarchy by transferring all imported 3D objects (or GameObject) under the root node.";
                    beginGroupBox("Hierarchy Optimization", isInspector, tooltip: tt);
                    {
                        tt = PiXYZUtils.getTooltipText <PiXYZSettings>("treeProcess");
                        EditorGUILayout.Space();
                        EditorGUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(20);
                            float width = GUI.skin.label.CalcSize(new GUIContent("Quality")).x;
                            GUILayout.Label("Mode", GUILayout.Width(width));
                            List <string> propertyNames = new List <string>(3);
                            propertyNames.Add("None");
                            propertyNames.Add("Clean-up intermediary nodes");
                            propertyNames.Add("Transfer all objects under root");
                            propertyNames.Add("Merge all objects");
                            propertyNames.Add("Merge objects by material");
                            List <int> intValue = new List <int>(3);
                            intValue.Add(0);
                            intValue.Add(1);
                            intValue.Add(2);
                            intValue.Add(3);
                            intValue.Add(4);
                            width = (float)Math.Truncate(Screen.width * 0.6);
                            Rect rect = EditorGUILayout.GetControlRect();
                            rect.width = width;
                            GUILayout.FlexibleSpace();
                            serializedProperty.FindPropertyRelative("treeProcess").intValue = EditorGUI.IntPopup(rect, serializedProperty.FindPropertyRelative("treeProcess").intValue, propertyNames.ToArray(), intValue.ToArray());
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                    endGroupBox();
                    GUILayout.Space(10);
                    if (!serializedObject.FindProperty("settings.useLods").boolValue)
                    {
                        tt = "Choose the quality level (preset) for the imported model.\nQuality defines the density of the mesh that PiXYZ creates.\nDepending if you import a CAD model (exact geometry) or a mesh model (tessellated geometry), PiXYZ will either perform a Tessellation or a Decimation on the model (see documentation for more information and presets details).";
                        beginGroupBox("Mesh Quality", isInspector, tooltip: tt);
                        {
                            EditorGUILayout.Space();
                            EditorGUILayout.BeginHorizontal();
                            {
                                GUILayout.Space(20);
                                tt = PiXYZUtils.getTooltipText <PiXYZLODSettings>("preset");
                                GUILayout.Label(new GUIContent("Quality", tt));
                                int width = (int)(Math.Truncate(Screen.width * 0.5));
                                EditorGUILayout.PropertyField(serializedObject.FindProperty("settings.lodSettings").GetArrayElementAtIndex(0).FindPropertyRelative("preset"), GUIContent.none, GUILayout.Width(width));
                                EditorGUILayout.BeginHorizontal();
                                {
                                    GUILayout.Space(5);
                                    GUILayout.Label("Use LODs");
                                    EditorGUILayout.PropertyField(serializedObject.FindProperty("settings.useLods"), GUIContent.none, GUILayout.Width(40));
                                }
                                EditorGUILayout.EndHorizontal();
                                GUILayout.FlexibleSpace();
                            }
                            EditorGUILayout.EndHorizontal();
                            EditorGUILayout.Space();
                        }
                        endGroupBox();
                    }
                    else
                    {
                        pixyzLods.printLoDSlider(serializedObject, prefix, winId, serializedProperty.FindPropertyRelative("treeProcess").intValue < 3, gameObject);
                    }
                    GUILayout.Space(10);
                    beginGroupBox("Post Process", isInspector, tooltip: "Generate UV : Use this setting to add a new primary UV set (channel #0). Set the size of the projection box used to create UVs.\n\nCaution: PiXYZ will override the existing UV set, do not Use this setting if you wish to preserve the UVs embedded in the imported model.\n\nOrient… : Use this setting for PiXYZ to perform a unification of all triangles orientation.\n\nCaution: Do not Use this setting if the imported model is a mesh (tessellated geometry) and is already correctly oriented.");
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            tt = PiXYZUtils.getTooltipText <PiXYZSettings>("mapUV");
                            EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("mapUV"), GUIContent.none, true, GUILayout.Width(40));
                            GUILayout.Label(new GUIContent("Generate UV (size)", tt));
                            //GUILayout.FlexibleSpace();
                            EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("mapUV3dSize"), GUIContent.none, true, GUILayout.Width(100));
                            GUILayout.Label(new GUIContent("millimeters", tt));
                            serializedProperty.FindPropertyRelative("mapUV3dSize").floatValue = Mathf.Clamp(serializedProperty.FindPropertyRelative("mapUV3dSize").floatValue, 1.0f, 1000f);
                            GUILayout.Space(10);
                        }
                        EditorGUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        {
                            tt = PiXYZUtils.getTooltipText <PiXYZSettings>("orient");
                            EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("orient"), GUIContent.none, true, GUILayout.Width(40));
                            GUILayout.Label(new GUIContent("Orient normals of adjacent faces consistently", tt), GUILayout.ExpandWidth(true));
                            GUILayout.FlexibleSpace();
                        }
                        GUILayout.EndHorizontal();
                    }
                    endGroupBox();

                    GUILayout.Space(10);
                    bool before = advancedToggle[winId];
                    advancedToggle[winId] = EditorGUILayout.Foldout(advancedToggle[winId], "Advanced", true);
                    if (advancedToggle[winId])
                    {
                        if (!before)
                        {
                            g_scrollViewPosition[winId] = new Vector2(0, Screen.height);
                        }
                        GUILayout.Space(10);
                        EditorGUI.indentLevel++;
                        string version = InternalEditorUtility.GetFullUnityVersion();
                        version = version.Substring(0, version.LastIndexOf('.'));
                        if (float.Parse(version) >= 2017.3)    //Cannot change before 2017.3
                        {
                            EditorGUI.BeginDisabledGroup(isInspector);
                            {
                                EditorGUILayout.BeginHorizontal();
                                {
                                    GUILayout.Space(10);
                                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("useMergeFinalAssemblies");
                                    serializedProperty.FindPropertyRelative("useMergeFinalAssemblies").boolValue = EditorGUILayout.Toggle(serializedProperty.FindPropertyRelative("useMergeFinalAssemblies").boolValue, GUILayout.Width(40));
                                    GUILayout.Label(new GUIContent("Stitch unconnected surfaces", tt));
                                    GUILayout.FlexibleSpace();
                                }
                                EditorGUILayout.EndHorizontal();
                                EditorGUILayout.BeginHorizontal();
                                {
                                    GUILayout.Space(10);
                                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("splitTo16BytesIndex");
                                    serializedProperty.FindPropertyRelative("splitTo16BytesIndex").boolValue = EditorGUILayout.Toggle(serializedProperty.FindPropertyRelative("splitTo16BytesIndex").boolValue, GUILayout.Width(40));
                                    GUILayout.Label(new GUIContent("Split to limit vertex count per mesh", tt));
                                    GUILayout.FlexibleSpace();
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            EditorGUI.EndDisabledGroup();
                        }
                        EditorGUILayout.Space();
                    }
                    EditorGUILayout.EndFadeGroup();
                    Rect boxRect = GUILayoutUtility.GetLastRect();
                    lastShown = (int)(boxRect.y + boxRect.height);
                }
            }
            EditorGUILayout.EndVertical();
        }
        GUILayout.EndScrollView();
        Rect scrollRect     = GUILayoutUtility.GetLastRect();
        int  gradientHeight = 15;

        //up
        if (scrollViewPosition.y > 0f)
        {
            PiXYZUtils.gradientBox(new Rect(scrollRect.x, scrollRect.y, scrollRect.width, gradientHeight), new Vector2(0.5f, 1f));
        }
        //down
        if (scrollViewPosition.y < (lastShown - scrollRect.height))
        {
            PiXYZUtils.gradientBox(new Rect(scrollRect.x, scrollRect.y + scrollRect.height - gradientHeight, scrollRect.width, gradientHeight), new Vector2(0.5f, 0f));
        }
    }
        private void RefreshData()
        {
            stringBuilder.Length = 0;

            Assembly editorAssembly = typeof(VRTK_SDKManagerEditor).Assembly;
            Assembly assembly       = typeof(VRTK_SDKManager).Assembly;

            Append(
                "Versions",
                () =>
            {
                Append("Unity", InternalEditorUtility.GetFullUnityVersion());
                Append("VRTK", VRTK_Defines.CurrentVersion + " (may not be correct if source is GitHub)");

                Type steamVRUpdateType = editorAssembly.GetType("SteamVR_Update");
                if (steamVRUpdateType != null)
                {
                    FieldInfo currentVersionField = steamVRUpdateType.GetField("currentVersion", BindingFlags.NonPublic | BindingFlags.Static);
                    if (currentVersionField != null)
                    {
                        string currentVersion = (string)currentVersionField.GetValue(null);
                        Append("SteamVR", currentVersion);
                    }
                }

                Type ovrPluginType = assembly.GetType("OVRPlugin");
                if (ovrPluginType != null)
                {
                    Append(
                        "OVRPlugin (Oculus Utilities)",
                        () =>
                    {
                        FieldInfo wrapperVersionField = ovrPluginType.GetField("wrapperVersion", BindingFlags.Public | BindingFlags.Static);
                        if (wrapperVersionField != null)
                        {
                            Version wrapperVersion = (Version)wrapperVersionField.GetValue(null);
                            Append("wrapperVersion", wrapperVersion);
                        }

                        PropertyInfo versionField = ovrPluginType.GetProperty("version", BindingFlags.Public | BindingFlags.Static);
                        if (versionField != null)
                        {
                            Version version = (Version)versionField.GetGetMethod().Invoke(null, null);
                            Append("version", version);
                        }

                        PropertyInfo nativeSDKVersionField = ovrPluginType.GetProperty("nativeSDKVersion", BindingFlags.Public | BindingFlags.Static);
                        if (nativeSDKVersionField != null)
                        {
                            Version nativeSDKVersion = (Version)nativeSDKVersionField.GetGetMethod().Invoke(null, null);
                            Append("nativeSDKVersion", nativeSDKVersion);
                        }
                    }
                        );
                }
            }
                );

            Append(
                "Scripting Define Symbols",
                () =>
            {
                foreach (BuildTargetGroup targetGroup in VRTK_SharedMethods.GetValidBuildTargetGroups())
                {
                    string symbols = string.Join(
                        ";",
                        PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup)
                        .Split(';')
                        .Where(symbol => !symbol.StartsWith(VRTK_Defines.VersionScriptingDefineSymbolPrefix, StringComparison.Ordinal))
                        .ToArray());
                    if (!string.IsNullOrEmpty(symbols))
                    {
                        Append(targetGroup, symbols);
                    }
                }
            }
                );

            stringBuilder.Length--;
        }
示例#18
0
        public void OnGUI()
        {
            AboutWindow.LoadLogos();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(AboutWindow.s_Header, GUIStyle.none, new GUILayoutOption[0]);
            this.ListenForSecretCodes();
            string text = string.Empty;

            if (InternalEditorUtility.HasFreeLicense())
            {
                text = " Personal";
            }
            if (InternalEditorUtility.HasEduLicense())
            {
                text = " Edu";
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(52f);
            string text2 = this.FormatExtensionVersionString();

            this.m_ShowDetailedVersion |= Event.current.alt;
            if (this.m_ShowDetailedVersion)
            {
                int      unityVersionDate = InternalEditorUtility.GetUnityVersionDate();
                DateTime dateTime         = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                string   unityBuildBranch = InternalEditorUtility.GetUnityBuildBranch();
                string   text3            = string.Empty;
                if (unityBuildBranch.Length > 0)
                {
                    text3 = "Branch: " + unityBuildBranch;
                }
                EditorGUILayout.SelectableLabel(string.Format("Version {0}{1}{2}\n{3:r}\n{4}", new object[]
                {
                    InternalEditorUtility.GetFullUnityVersion(),
                    text,
                    text2,
                    dateTime.AddSeconds((double)unityVersionDate),
                    text3
                }), new GUILayoutOption[]
                {
                    GUILayout.Width(400f),
                    GUILayout.Height(42f)
                });
                this.m_TextInitialYPos = 108f;
            }
            else
            {
                GUILayout.Label(string.Format("Version {0}{1}{2}", Application.unityVersion, text, text2), new GUILayoutOption[0]);
            }
            if (Event.current.type == EventType.ValidateCommand)
            {
                return;
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(4f);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            float creditsWidth = base.position.width - 10f;
            float num          = this.m_TextYPos;

            GUI.BeginGroup(GUILayoutUtility.GetRect(10f, this.m_TextInitialYPos));
            string[] nameChunks = AboutWindowNames.nameChunks;
            for (int i = 0; i < nameChunks.Length; i++)
            {
                string nameChunk = nameChunks[i];
                num = AboutWindow.DoCreditsNameChunk(nameChunk, creditsWidth, num);
            }
            num = AboutWindow.DoCreditsNameChunk("Thanks to Forest 'Yoggy' Johnson, Graham McAllister, David Janik-Jones, Raimund Schumacher, Alan J. Dickins and Emil 'Humus' Persson", creditsWidth, num);
            this.m_TotalCreditsHeight = num - this.m_TextYPos;
            GUI.EndGroup();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label(AboutWindow.s_MonoLogo, new GUILayoutOption[0]);
            GUILayout.Label("Scripting powered by The Mono Project.\n\n(c) 2011 Novell, Inc.", "MiniLabel", new GUILayoutOption[]
            {
                GUILayout.Width(200f)
            });
            GUILayout.Label(AboutWindow.s_AgeiaLogo, new GUILayoutOption[0]);
            GUILayout.Label("Physics powered by PhysX.\n\n(c) 2011 NVIDIA Corporation.", "MiniLabel", new GUILayoutOption[]
            {
                GUILayout.Width(200f)
            });
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            string aboutWindowLabel = UnityVSSupport.GetAboutWindowLabel();

            if (aboutWindowLabel.Length > 0)
            {
                GUILayout.Label(aboutWindowLabel, "MiniLabel", new GUILayoutOption[0]);
            }
            GUILayout.Label(InternalEditorUtility.GetUnityCopyright(), "MiniLabel", new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.Space(10f);
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(InternalEditorUtility.GetLicenseInfo(), "AboutWindowLicenseLabel", new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
        }
        public void OnGUI()
        {
            LoadResources();


            GUILayout.BeginVertical();
            GUILayout.Space(10);
            GUI.Box(new Rect(13, 8, s_UnityLogo.image.width, s_UnityLogo.image.height), s_UnityLogo, GUIStyle.none);
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            GUILayout.Space(120);
            GUILayout.BeginVertical();

            if (s_HasConnectionError)
            {
                GUILayout.Label(s_ErrorString, "WordWrappedLabel", GUILayout.Width(405));
            }
            else if (s_HasUpdate)
            {
                GUILayout.Label(string.Format(s_TextHasUpdate.text, InternalEditorUtility.GetFullUnityVersion(), s_LatestVersionString), "WordWrappedLabel", GUILayout.Width(300));

                GUILayout.Space(20);
                m_ScrollPos = EditorGUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(405), GUILayout.Height(200));
                GUILayout.Label(s_LatestVersionMessage, "WordWrappedLabel");
                EditorGUILayout.EndScrollView();

                GUILayout.Space(20);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Download new version", GUILayout.Width(200)))
                {
                    Help.BrowseURL(s_UpdateURL);
                }

                if (GUILayout.Button("Skip new version", GUILayout.Width(200)))
                {
                    EditorPrefs.SetString("EditorUpdateSkipVersionString", s_LatestVersionString);
                    Close();
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.Label(string.Format(s_TextUpToDate.text, Application.unityVersion), "WordWrappedLabel", GUILayout.Width(405));
            }


            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUILayout.Space(8);


            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(GUILayout.Height(20));
            GUILayout.FlexibleSpace();
            GUI.changed     = false;
            s_ShowAtStartup = GUILayout.Toggle(s_ShowAtStartup, s_CheckForNewUpdatesText);
            if (GUI.changed)
            {
                EditorPrefs.SetBool("EditorUpdateShowAtStartup", s_ShowAtStartup);
            }

            GUILayout.Space(10);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
示例#20
0
        public void OnGUI()
        {
            LoadLogos();
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.Label(s_Header, GUIStyle.none);

            ListenForSecretCodes();

            var licenseTypeString = "";

            if (InternalEditorUtility.HasFreeLicense())
            {
                licenseTypeString = " Personal";
            }
            if (InternalEditorUtility.HasEduLicense())
            {
                licenseTypeString = " Edu";
            }

            GUILayout.BeginHorizontal();
            GUILayout.Space(52f); // Ident version information

            string extensionVersion = FormatExtensionVersionString();

            m_ShowDetailedVersion |= Event.current.alt;
            if (m_ShowDetailedVersion)
            {
                int      t            = InternalEditorUtility.GetUnityVersionDate();
                DateTime dt           = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                string   branch       = InternalEditorUtility.GetUnityBuildBranch();
                string   branchString = "";
                if (branch.Length > 0)
                {
                    branchString = "Branch: " + branch;
                }
                EditorGUILayout.SelectableLabel(
                    string.Format("Version {0}{1}{2}\n{3:r}\n{4}", InternalEditorUtility.GetFullUnityVersion(), licenseTypeString, extensionVersion, dt.AddSeconds(t), branchString),
                    GUILayout.Width(550), GUILayout.Height(42));

                m_TextInitialYPos = 120 - 12;
            }
            else
            {
                GUILayout.Label(string.Format("Version {0}{1}{2}", Application.unityVersion, licenseTypeString, extensionVersion));
            }

            if (Event.current.type == EventType.ValidateCommand)
            {
                return;
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(4);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            float creditsWidth = position.width - 10;
            float chunkOffset  = m_TextYPos;

            Rect scrollAreaRect = GUILayoutUtility.GetRect(10, m_TextInitialYPos);

            GUI.BeginGroup(scrollAreaRect);
            foreach (string nameChunk in AboutWindowNames.Names(null, true))
            {
                chunkOffset = DoCreditsNameChunk(nameChunk, creditsWidth, chunkOffset);
            }
            chunkOffset          = DoCreditsNameChunk(kSpecialThanksNames, creditsWidth, chunkOffset);
            m_TotalCreditsHeight = chunkOffset - m_TextYPos;
            GUI.EndGroup();

            HandleScrollEvents(scrollAreaRect);

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.Label(s_MonoLogo);
            GUILayout.Label("Scripting powered by The Mono Project.\n\n(c) 2011 Novell, Inc.", "MiniLabel", GUILayout.Width(200));
            GUILayout.Label(s_AgeiaLogo);
            GUILayout.Label("Physics powered by PhysX.\n\n(c) 2011 NVIDIA Corporation.", "MiniLabel", GUILayout.Width(200));
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            var VSTUlabel = UnityVSSupport.GetAboutWindowLabel();

            if (VSTUlabel.Length > 0)
            {
                GUILayout.Label(VSTUlabel, "MiniLabel");
            }
            GUILayout.Label(InternalEditorUtility.GetUnityCopyright(), "MiniLabel");
            GUILayout.EndVertical();
            GUILayout.Space(10);
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.Label(InternalEditorUtility.GetLicenseInfo(), "AboutWindowLicenseLabel");
            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
        }
示例#21
0
    /*
     * THIS CAUSES RANDOM CRASHES
     *
     * private static void PreLoadAnimationNodes()
     * {
     *          // In Editor, convince Burst to JIT compile all Animation UNode types immediately.
     #if UNITY_EDITOR
     *          var start = UnityEngine.Time.realtimeSinceStartup;
     *          var wasSyncCompile = Menu.GetChecked("Jobs/Burst/Synchronous Compilation");
     *          Menu.SetChecked("Jobs/Burst/Synchronous Compilation", true);
     *          try
     *          {
     *              var animAssembly = typeof(Unity.Animation.AnimationGraphSystem).Assembly;
     *              var unodeNonGenericTypes = animAssembly.GetTypes().Where(t =>
     *                  t.IsClass && !t.IsAbstract && !t.IsGenericType &&
     *                  typeof(Unity.DataFlowGraph.INodeFunctionality).IsAssignableFrom(t));
     *              var unodeGenericTypesReferencedInData = animAssembly.GetTypes()
     *                  .Where(t => !t.IsClass && typeof(Unity.DataFlowGraph.INodeData).IsAssignableFrom(t))
     *                  .Select(t => t
     *                      .GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
     *                      .Select(fi => fi.FieldType)
     *                      .Where(ft => ft.IsGenericType && ft.GetGenericTypeDefinition() == typeof(Unity.DataFlowGraph.NodeHandle<>))
     *                      .Select(ft => ft.GetGenericArguments()[0])
     *                      .Where(ft => ft.IsGenericType))
     *                  .SelectMany(t => t)
     *                  .Distinct();
     *
     *              var nodeSet = new Unity.DataFlowGraph.NodeSet();
     *
     *              MethodInfo getFunctionality = nodeSet.GetType().GetMethod("GetFunctionality", new System.Type[0]);
     *              foreach (System.Type t in unodeNonGenericTypes.Concat(unodeGenericTypesReferencedInData))
     *                  getFunctionality.MakeGenericMethod(t).Invoke(nodeSet, null);
     *
     *              nodeSet.Dispose();
     *
     *              Debug.Log($"Compilation of Animation UNode types took {UnityEngine.Time.realtimeSinceStartup - start} seconds");
     *          }
     *          finally
     *          {
     *              Menu.SetChecked("Jobs/Burst/Synchronous Compilation", wasSyncCompile);
     *          }
     #endif
     * }
     */

    public void Awake()
    {
        GameDebug.Assert(game == null);
        DontDestroyOnLoad(gameObject);
        game = this;

        GameApp.IsInitialized = true;

        //PreLoadAnimationNodes();

        m_StopwatchFrequency = System.Diagnostics.Stopwatch.Frequency;
        m_Clock = new System.Diagnostics.Stopwatch();
        m_Clock.Start();

#if UNITY_EDITOR
        _buildUnityVersion = InternalEditorUtility.GetFullUnityVersion();
#endif
        var buildInfo = FindObjectOfType <BuildInfo>();
        if (buildInfo != null)
        {
            _buildId           = buildInfo.buildId;
            _buildUnityVersion = buildInfo.buildUnityVersion;
        }

        var commandLineArgs = new List <string>(System.Environment.GetCommandLineArgs());

        // TODO we should only initialize this if we have a graphics device (i.e. non-headless)
        Overlay.Managed.Initialize();

#if UNITY_STANDALONE_LINUX
        m_isHeadless = true;
#else
        m_isHeadless = commandLineArgs.Contains("-batchmode");
#endif
        var noconsole           = commandLineArgs.Contains("-noconsole");
        var consoleRestoreFocus = commandLineArgs.Contains("-consolerestorefocus");
        if (noconsole)
        {
            UnityEngine.Debug.Log("WARNING: starting without a console");
            var consoleUI = new ConsoleNullUI();
            Console.Init(buildId, buildUnityVersion, consoleUI);
        }
        else if (m_isHeadless)
        {
#if UNITY_EDITOR
            Debug.LogError("ERROR: Headless mode not supported in editor");
#endif

#if UNITY_STANDALONE_WIN
            string consoleTitle;

            var overrideTitle = ArgumentForOption(commandLineArgs, "-title");
            if (overrideTitle != null)
            {
                consoleTitle = overrideTitle;
            }
            else
            {
                consoleTitle = Application.productName + " Console";
            }

            consoleTitle += " [" + System.Diagnostics.Process.GetCurrentProcess().Id + "]";

            var consoleUI = new ConsoleTextWin(consoleTitle, consoleRestoreFocus);
#elif UNITY_STANDALONE_LINUX
            var consoleUI = new ConsoleTextLinux();
#else
            UnityEngine.Debug.Log("WARNING: starting without a console");
            var consoleUI = new ConsoleNullUI();
#endif
            Console.Init(buildId, buildUnityVersion, consoleUI);
        }
        else
        {
            var consoleUI = Instantiate(Resources.Load <ConsoleGUI>("Prefabs/ConsoleGUI"));
            DontDestroyOnLoad(consoleUI);
            Console.Init(buildId, buildUnityVersion, consoleUI);

            m_DebugOverlay = Instantiate(Resources.Load <DebugOverlay>("DebugOverlay"));
            DontDestroyOnLoad(m_DebugOverlay);
            m_DebugOverlay.Init();

            m_GameStatistics = new GameStatistics();
        }

        // If -logfile was passed, we try to put our own logs next to the engine's logfile
        // if -logfile was set to "-" we forward our logs to Debug.Log, so that it ends up on stdout.
        var engineLogFileLocation = ".";
        var logName             = m_isHeadless ? "game_" + DateTime.UtcNow.ToString("yyyyMMdd_HHmmss_fff") : "game";
        var logfileArgIdx       = commandLineArgs.IndexOf("-logfile");
        var forceForwardToDebug = false;
        if (logfileArgIdx >= 0 && commandLineArgs.Count >= logfileArgIdx)
        {
            var logFile = commandLineArgs[logfileArgIdx + 1];
            if (logFile == "-")
            {
                forceForwardToDebug = true;
            }
            else
            {
                engineLogFileLocation = System.IO.Path.GetDirectoryName(logFile);
            }
        }
        GameDebug.Init(engineLogFileLocation, logName, forceForwardToDebug);

        ConfigVar.Init();

        // Support -port and -query_port as per Multiplay standard
        var serverPort = ArgumentForOption(commandLineArgs, "-port");
        if (serverPort != null)
        {
            Console.EnqueueCommandNoHistory("server.port " + serverPort);
        }

        var sqpPort = ArgumentForOption(commandLineArgs, "-query_port");
        if (sqpPort != null)
        {
            Console.EnqueueCommandNoHistory("server.sqp_port " + sqpPort);
        }

        Console.EnqueueCommandNoHistory("exec -s " + k_UserConfigFilename);

        // Default is to allow no frame cap, i.e. as fast as possible if vsync is disabled
        Application.targetFrameRate = -1;

        if (m_isHeadless)
        {
            Application.targetFrameRate = serverTickRate.IntValue;
            QualitySettings.vSyncCount  = 0; // Needed to make targetFramerate work; even in headless mode

#if !UNITY_STANDALONE_LINUX
            if (!commandLineArgs.Contains("-nographics"))
            {
                GameDebug.Log("WARNING: running -batchmod without -nographics");
            }
#endif
        }
        else
        {
            RenderSettings.Init();
        }

        // Out of the box game behaviour is driven by boot.cfg unless you ask it not to
        if (!commandLineArgs.Contains("-noboot"))
        {
            Console.EnqueueCommandNoHistory("exec -s " + k_BootConfigFilename);
        }

        if (m_isHeadless)
        {
            SoundSystem.Initialize(new SoundSystemNull());
        }
        else
        {
            var soundSystem = new SoundSystemBase();
            soundSystem.Init(audioMixer);
            SoundSystem.Initialize(soundSystem);

            GameObject go = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/ClientFrontend", typeof(GameObject)));
            UnityEngine.Object.DontDestroyOnLoad(go);
            clientFrontend = go.GetComponentInChildren <ClientFrontend>();
        }

        sqpClient = new SQP.SQPClient();

        GameDebug.Log("A2 initialized");
#if UNITY_EDITOR
        GameDebug.Log("Build type: editor");
#elif DEVELOPMENT_BUILD
        GameDebug.Log("Build type: development");
#else
        GameDebug.Log("Build type: release");
#endif
        GameDebug.Log("BuildID: " + buildId);
        GameDebug.Log("Unity: " + buildUnityVersion);
        GameDebug.Log("Cwd: " + System.IO.Directory.GetCurrentDirectory());

        levelManager = new LevelManager();
        levelManager.Init();
        GameDebug.Log("LevelManager initialized");

        GameDebug.Log("InputSystem initialized");

        // Game loops
        Console.AddCommand("serve", CmdServe, "Start server listening");
        Console.AddCommand("client", CmdClient, "client: Enter client mode.");
        Console.AddCommand("thinclient", CmdThinClient, "client: Enter thin client mode.");
        Console.AddCommand("boot", CmdBoot, "Go back to boot loop");
        Console.AddCommand("connect", CmdConnect, "connect <ip>: Connect to server on ip (default: localhost)");

        Console.AddCommand("menu", CmdMenu, "show the main menu");
        Console.AddCommand("load", CmdLoad, "Load level");
        Console.AddCommand("quit", CmdQuit, "Quits");
        Console.AddCommand("screenshot", CmdScreenshot, "Capture screenshot. Optional argument is destination folder or filename.");
        Console.AddCommand("crashme", (string[] args) => { GameDebug.Assert(false); }, "Crashes the game next frame ");
        Console.AddCommand("saveconfig", CmdSaveConfig, "Save the user config variables");
        Console.AddCommand("loadconfig", CmdLoadConfig, "Load the user config variables");

        Console.AddCommand("profile", CmdProfile, "Run the profiling for a level");

#if UNITY_STANDALONE_WIN
        Console.AddCommand("windowpos", CmdWindowPosition, "Position of window. e.g. windowpos 100,100");
#endif

        Console.SetOpen(true);
        Console.ProcessCommandLineArguments(commandLineArgs.ToArray());
#if UNITY_IOS
        // (marton) This is a hack to work around command line arguments not working on iOS
        if (!Application.isEditor)
        {
            Console.EnqueueCommandNoHistory("preview Level_00");
        }
#endif



        GameApp.CameraStack.OnCameraEnabledChanged += OnCameraEnabledChanged;
        GameApp.CameraStack.PushCamera(bootCamera);
    }
    public void updateText()
    {
#if UNITY_EDITOR
        colorspace = PlayerSettings.colorSpace.ToString();
        grahicsjob = PlayerSettings.graphicsJobMode.ToString();
#endif

        tm.text = "";


        #if UNITY_EDITOR
        tm.text = tm.text + TitleText("Unity : ") + InternalEditorUtility.GetFullUnityVersion() + "\n";
        tm.text = tm.text + TitleText("Branch : ") + InternalEditorUtility.GetUnityBuildBranch() + "\n";
        #else
        tm.text = tm.text + TitleText("Unity : ") + Application.unityVersion + "\n";
        #endif
        tm.text = tm.text + TitleText("Device : ") + SystemInfo.deviceModel + "\n";
        tm.text = tm.text + TitleText("OS : ") + SystemInfo.operatingSystem + "\n";
        tm.text = tm.text + TitleText("CPU : ") + SystemInfo.processorType + "\n";
        tm.text = tm.text + TitleText("GPU : ") + SystemInfo.graphicsDeviceName + "\n";
        tm.text = tm.text + TitleText("GPU Version : ") + SystemInfo.graphicsDeviceVersion + "\n";
        tm.text = tm.text + TitleText("API : ") + SystemInfo.graphicsDeviceType + "\n";
        tm.text = tm.text + TitleText("Platform : ") + Application.platform.ToString() + "\n";
        tm.text = tm.text + "<i>" + TitleText("Color Space : ") + colorspace + "</i>" + "\n";
        tm.text = tm.text + "<i>" + TitleText("GraphicsJob Mode : ") + grahicsjob + "</i>" + "\n";
        tm.text = tm.text + TitleText("Multi-thread : ") + BooleanText(SystemInfo.graphicsMultiThreaded) + "\n";
        tm.text = tm.text + TitleText("VSync : ") + QualitySettings.vSyncCount.ToString() + "\n";
        tm.text = tm.text + TitleText("S.M. Support : ") + SystemInfo.graphicsShaderLevel.ToString() + "\n";
        tm.text = tm.text + TitleText("Tier : ") + Graphics.activeTier.ToString() + "\n";

        if (Camera.main != null)
        {
            tm.text = tm.text + TitleText("Camera Rendering Path : ") + Camera.main.renderingPath.ToString() + "\n";
            #if UNITY_5_6_OR_NEWER
            if (Camera.main.allowHDR)
            {
                tm_hdr.text = "HDR On";
            }
            else
            {
                tm_hdr.text = "HDR Off";
            }
            if (Camera.main.allowMSAA)
            {
                tm_msaa.text = "MSAA On";
            }
            else
            {
                tm_msaa.text = "MSAA Off";
            }
            #endif
            tm_renderpath.text = Camera.main.renderingPath.ToString();
        }
        else
        {
            tm.text            = tm.text + WarningText("Camera is null") + "\n";
            tm_hdr.text        = "HDR --";
            tm_msaa.text       = "MSAA --";
            tm_renderpath.text = "Change Render Path";
        }

        tm.text = tm.text + H2Text("Compute Shader : ") + BooleanText(SystemInfo.supportsComputeShaders) + "\n";
        tm.text = tm.text + H2Text("GPU Instancing : ") + BooleanText(SystemInfo.supportsInstancing) + "\n";
        tm.text = tm.text + H2Text("2D Array Texture : ") + BooleanText(SystemInfo.supports2DArrayTextures) + "\n";
        tm.text = tm.text + H2Text("3D Texture : ") + BooleanText(SystemInfo.supports3DTextures) + "\n";
        #if UNITY_5_6_OR_NEWER
        tm.text = tm.text + H2Text("3D Render Texture : ") + BooleanText(SystemInfo.supports3DRenderTextures) + "\n";
        #endif
        tm.text = tm.text + H2Text("Cubemap Array Texture : ") + BooleanText(SystemInfo.supportsCubemapArrayTextures) + "\n";
        //tm.text = tm.text + H2Text("Image Effect : ") + BooleanText(SystemInfo.) + "\n";
        // tm.text = tm.text + H2Text("Motion Vector : ") + BooleanText(SystemInfo.supportsMotionVectors) + "\n";
        // tm.text = tm.text + H2Text("Raw Shadow Depth Sampling : ") + BooleanText(SystemInfo.supportsRawShadowDepthSampling) + "\n";
        tm.text = tm.text + H2Text("Sparse Textures : ") + BooleanText(SystemInfo.supportsSparseTextures) + "\n";
        tm.text = tm.text + H2Text("Max Cubemap Size : ") + SystemInfo.maxCubemapSize + "\n";
        tm.text = tm.text + H2Text("Max Texture Size : ") + SystemInfo.maxTextureSize + "\n";
        tm.text = tm.text + H2Text("Render Target Count : ") + SystemInfo.supportedRenderTargetCount + "\n";

        //tm.text = tm.text + "MSG"  + "\n";
        if (SceneManager.sceneCount > 1)
        {
            float count = SceneManager.sceneCountInBuildSettings - 1;
            tm.text = tm.text + TitleText(SceneManager.GetSceneAt(1).buildIndex + "/" + count) + " " +
                      SceneManager.GetSceneAt(1).name.ToString() + "\n";
        }
        else
        {
            tm.text = tm.text + TitleText(SceneManager.GetActiveScene().buildIndex + "/" +
                                          SceneManager.sceneCountInBuildSettings) + " " +
                      SceneManager.GetActiveScene().name.ToString() + "\n";
        }

        tm.text = tm.text + "Click Here to Show/Hide";

        //
        tm_vsync.text = "VSync " + QualitySettings.vSyncCount;
        tm_tier.text  = Graphics.activeTier.ToString();
    }
示例#23
0
        public void OnGUI()
        {
            LoadLogos();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(s_Header, GUIStyle.none, new GUILayoutOption[0]);
            this.ListenForSecretCodes();
            string str = string.Empty;

            if (InternalEditorUtility.HasFreeLicense())
            {
                str = " Personal";
            }
            if (InternalEditorUtility.HasEduLicense())
            {
                str = " Edu";
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(52f);
            string str2 = this.FormatExtensionVersionString();

            this.m_ShowDetailedVersion |= Event.current.alt;
            if (this.m_ShowDetailedVersion)
            {
                int      unityVersionDate = InternalEditorUtility.GetUnityVersionDate();
                DateTime time             = new DateTime(0x7b2, 1, 1, 0, 0, 0, 0);
                string   unityBuildBranch = InternalEditorUtility.GetUnityBuildBranch();
                string   str4             = string.Empty;
                if (unityBuildBranch.Length > 0)
                {
                    str4 = "Branch: " + unityBuildBranch;
                }
                object[]          args    = new object[] { InternalEditorUtility.GetFullUnityVersion(), str, str2, time.AddSeconds((double)unityVersionDate), str4 };
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(400f), GUILayout.Height(42f) };
                EditorGUILayout.SelectableLabel(string.Format("Version {0}{1}{2}\n{3:r}\n{4}", args), options);
                this.m_TextInitialYPos = 108f;
            }
            else
            {
                GUILayout.Label(string.Format("Version {0}{1}{2}", Application.unityVersion, str, str2), new GUILayoutOption[0]);
            }
            if (Event.current.type != EventType.ValidateCommand)
            {
                GUILayout.EndHorizontal();
                GUILayout.Space(4f);
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUI.BeginGroup(GUILayoutUtility.GetRect(10f, this.m_TextInitialYPos));
                float width    = base.position.width - 10f;
                float height   = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(this.kCreditsNames), width);
                Rect  position = new Rect(5f, this.m_TextYPos, width, height);
                GUI.Label(position, this.kCreditsNames, EditorStyles.wordWrappedLabel);
                float num4  = EditorStyles.wordWrappedMiniLabel.CalcHeight(GUIContent.Temp("Thanks to Forest 'Yoggy' Johnson, Graham McAllister, David Janik-Jones, Raimund Schumacher, Alan J. Dickins and Emil 'Humus' Persson"), width);
                Rect  rect2 = new Rect(5f, this.m_TextYPos + height, width, num4);
                GUI.Label(rect2, "Thanks to Forest 'Yoggy' Johnson, Graham McAllister, David Janik-Jones, Raimund Schumacher, Alan J. Dickins and Emil 'Humus' Persson", EditorStyles.wordWrappedMiniLabel);
                GUI.EndGroup();
                this.m_TotalCreditsHeight = height + num4;
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label(s_MonoLogo, new GUILayoutOption[0]);
                GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(200f) };
                GUILayout.Label("Scripting powered by The Mono Project.\n\n(c) 2011 Novell, Inc.", "MiniLabel", optionArray2);
                GUILayout.Label(s_AgeiaLogo, new GUILayoutOption[0]);
                GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(200f) };
                GUILayout.Label("Physics powered by PhysX.\n\n(c) 2011 NVIDIA Corporation.", "MiniLabel", optionArray3);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(5f);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                string aboutWindowLabel = UnityVSSupport.GetAboutWindowLabel();
                if (aboutWindowLabel.Length > 0)
                {
                    GUILayout.Label(aboutWindowLabel, "MiniLabel", new GUILayoutOption[0]);
                }
                GUILayout.Label(InternalEditorUtility.GetUnityCopyright(), "MiniLabel", new GUILayoutOption[0]);
                GUILayout.EndVertical();
                GUILayout.Space(10f);
                GUILayout.FlexibleSpace();
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.Label(InternalEditorUtility.GetLicenseInfo(), "AboutWindowLicenseLabel", new GUILayoutOption[0]);
                GUILayout.EndVertical();
                GUILayout.Space(5f);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);
            }
        }
示例#24
0
        public void OnGUI()
        {
            AboutWindow.LoadLogos();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(AboutWindow.s_Header, GUIStyle.none, new GUILayoutOption[0]);
            this.ListenForSecretCodes();
            string text = string.Empty;

            if (InternalEditorUtility.HasPro())
            {
                text = " Pro";
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(52f);
            this.m_ShowDetailedVersion |= Event.current.alt;
            if (this.m_ShowDetailedVersion)
            {
                int      unityVersionDate = InternalEditorUtility.GetUnityVersionDate();
                DateTime dateTime         = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                string   unityBuildBranch = InternalEditorUtility.GetUnityBuildBranch();
                string   text2            = string.Empty;
                if (unityBuildBranch.Length > 0)
                {
                    text2 = "Branch: " + unityBuildBranch;
                }
                EditorGUILayout.SelectableLabel(string.Format("Version {0}{1}\n{2:r}\n{3}", new object[]
                {
                    InternalEditorUtility.GetFullUnityVersion(),
                    text,
                    dateTime.AddSeconds((double)unityVersionDate),
                    text2
                }), new GUILayoutOption[]
                {
                    GUILayout.Width(400f),
                    GUILayout.Height(42f)
                });
                this.m_TextInitialYPos = 108f;
            }
            else
            {
                GUILayout.Label(string.Format("Version {0}{1}", Application.unityVersion, text), new GUILayoutOption[0]);
            }
            if (Event.current.type == EventType.ValidateCommand)
            {
                return;
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(4f);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUI.BeginGroup(GUILayoutUtility.GetRect(10f, this.m_TextInitialYPos));
            float width    = base.position.width - 10f;
            float num      = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(this.kCreditsNames), width);
            Rect  position = new Rect(5f, this.m_TextYPos, width, num);

            GUI.Label(position, this.kCreditsNames, EditorStyles.wordWrappedLabel);
            float num2      = EditorStyles.wordWrappedMiniLabel.CalcHeight(GUIContent.Temp("Thanks to Forest 'Yoggy' Johnson, Graham McAllister, David Janik-Jones, Raimund Schumacher, Alan J. Dickins and Emil 'Humus' Persson"), width);
            Rect  position2 = new Rect(5f, this.m_TextYPos + num, width, num2);

            GUI.Label(position2, "Thanks to Forest 'Yoggy' Johnson, Graham McAllister, David Janik-Jones, Raimund Schumacher, Alan J. Dickins and Emil 'Humus' Persson", EditorStyles.wordWrappedMiniLabel);
            GUI.EndGroup();
            this.m_TotalCreditsHeight = num + num2;
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label(AboutWindow.s_MonoLogo, new GUILayoutOption[0]);
            GUILayout.Label("Scripting powered by The Mono Project.\n\n(c) 2011 Novell, Inc.", "MiniLabel", new GUILayoutOption[]
            {
                GUILayout.Width(200f)
            });
            GUILayout.Label(AboutWindow.s_AgeiaLogo, new GUILayoutOption[0]);
            GUILayout.Label("Physics powered by PhysX.\n\n(c) 2011 NVIDIA Corporation.", "MiniLabel", new GUILayoutOption[]
            {
                GUILayout.Width(200f)
            });
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label("\n" + InternalEditorUtility.GetUnityCopyright(), "MiniLabel", new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.Space(10f);
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(InternalEditorUtility.GetLicenseInfo(), "AboutWindowLicenseLabel", new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
        }
示例#25
0
        private void RefreshData()
        {
            stringBuilder.Length = 0;

            Assembly editorAssembly = typeof(VRTK_SDKManagerEditor).Assembly;
            Assembly assembly       = typeof(VRTK_SDKManager).Assembly;

            Append(
                "Versions",
                () =>
            {
                Append("Unity", InternalEditorUtility.GetFullUnityVersion());

                Type steamVRUpdateType = editorAssembly.GetType("SteamVR_Update");
                if (steamVRUpdateType != null)
                {
                    FieldInfo currentVersionField = steamVRUpdateType.GetField("currentVersion", BindingFlags.NonPublic | BindingFlags.Static);
                    if (currentVersionField != null)
                    {
                        string currentVersion = (string)currentVersionField.GetValue(null);
                        Append("SteamVR", currentVersion);
                    }
                }

                Type ovrPluginType = assembly.GetType("OVRPlugin");
                if (ovrPluginType != null)
                {
                    Append(
                        "OVRPlugin (Oculus Utilities)",
                        () =>
                    {
                        FieldInfo wrapperVersionField = ovrPluginType.GetField("wrapperVersion", BindingFlags.Public | BindingFlags.Static);
                        if (wrapperVersionField != null)
                        {
                            Version wrapperVersion = (Version)wrapperVersionField.GetValue(null);
                            Append("wrapperVersion", wrapperVersion);
                        }

                        PropertyInfo versionField = ovrPluginType.GetProperty("version", BindingFlags.Public | BindingFlags.Static);
                        if (versionField != null)
                        {
                            Version version = (Version)versionField.GetGetMethod().Invoke(null, null);
                            Append("version", version);
                        }

                        PropertyInfo nativeSDKVersionField = ovrPluginType.GetProperty("nativeSDKVersion", BindingFlags.Public | BindingFlags.Static);
                        if (nativeSDKVersionField != null)
                        {
                            Version nativeSDKVersion = (Version)nativeSDKVersionField.GetGetMethod().Invoke(null, null);
                            Append("nativeSDKVersion", nativeSDKVersion);
                        }
                    }
                        );
                }
            }
                );

            Append(
                "VR Settings",
                () =>
            {
                foreach (BuildTargetGroup targetGroup in VRTK_SharedMethods.GetValidBuildTargetGroups())
                {
                    bool isVREnabled;
#if UNITY_5_5_OR_NEWER
                    isVREnabled = VREditor.GetVREnabledOnTargetGroup(targetGroup);
#else
                    isVREnabled = VREditor.GetVREnabled(targetGroup);
#endif
                    if (!isVREnabled)
                    {
                        continue;
                    }

                    string[] vrEnabledDevices;
#if UNITY_5_5_OR_NEWER
                    vrEnabledDevices = VREditor.GetVREnabledDevicesOnTargetGroup(targetGroup);
#else
                    vrEnabledDevices = VREditor.GetVREnabledDevices(targetGroup);
#endif
                    Append(targetGroup, string.Join(", ", vrEnabledDevices));
                }
            }
                );

            Append(
                "Scripting Define Symbols",
                () =>
            {
                foreach (BuildTargetGroup targetGroup in VRTK_SharedMethods.GetValidBuildTargetGroups())
                {
                    string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup);
                    if (!string.IsNullOrEmpty(symbols))
                    {
                        Append(targetGroup, symbols);
                    }
                }
            }
                );

            stringBuilder.Length--;
        }
示例#26
0
    static UnityEditor.Build.Reporting.BuildReport BuildGame(string buildPath, string exeName, BuildTarget target,
                                                             BuildOptions opts, string buildId, ScriptingImplementation scriptingImplementation, bool includeEditorMetadata = false)
    {
        var    exePathName   = buildPath + "/" + exeName;
        string fullBuildPath = Directory.GetCurrentDirectory() + "/" + buildPath;
        var    levels        = new List <string>
        {
            "Assets/Scenes/bootstrapper.unity",
            "Assets/Scenes/empty.unity"
        };

        // Add scenes referenced from levelinfo's
        foreach (var li in LoadLevelInfos())
        {
            levels.Add(AssetDatabase.GetAssetPath(li.main_scene));
        }

        Debug.Log("Levels in build:");
        foreach (var l in levels)
        {
            Debug.Log(string.Format(" - {0}", l));
        }

        Debug.Log("Building: " + exePathName);
        Directory.CreateDirectory(buildPath);

        if (scriptingImplementation == ScriptingImplementation.WinRTDotNET)
        {
            throw new Exception(string.Format("Unsupported scriptingImplementation {0}", scriptingImplementation));
        }

        MakeBuildFilesWritable(fullBuildPath);
        using (new MakeInstallationFilesWritableScope())
        {
            var il2cpp = scriptingImplementation == ScriptingImplementation.IL2CPP;

            var monoDirs   = Directory.GetDirectories(fullBuildPath).Where(s => s.Contains("MonoBleedingEdge"));
            var il2cppDirs = Directory.GetDirectories(fullBuildPath)
                             .Where(s => s.Contains("BackUpThisFolder_ButDontShipItWithYourGame"));
            var clearFolder = (il2cpp && monoDirs.Count() > 0) || (!il2cpp && il2cppDirs.Count() > 0);
            if (clearFolder)
            {
                Debug.Log(" deleting old folders ..");
                foreach (var file in Directory.GetFiles(fullBuildPath))
                {
                    File.Delete(file);
                }
                foreach (var dir in monoDirs)
                {
                    Directory.Delete(dir, true);
                }
                foreach (var dir in il2cppDirs)
                {
                    Directory.Delete(dir, true);
                }
                foreach (var dir in Directory.GetDirectories(fullBuildPath).Where(s => s.EndsWith("_Data")))
                {
                    Directory.Delete(dir, true);
                }
            }

            UnityEditor.PlayerSettings.SetScriptingBackend(BuildTargetGroup.Standalone, scriptingImplementation);

            if (il2cpp)
            {
                UnityEditor.PlayerSettings.SetIl2CppCompilerConfiguration(BuildTargetGroup.Standalone,
                                                                          Il2CppCompilerConfiguration.Release);
            }

            if (includeEditorMetadata)
            {
                //PerformanceTest.SaveEditorInfo(opts, target);
            }

            Environment.SetEnvironmentVariable("BUILD_ID", buildId, EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable("BUILD_UNITY_VERSION", InternalEditorUtility.GetFullUnityVersion(),
                                               EnvironmentVariableTarget.Process);

            var time = DateTime.Now;
            GameDebug.Log("BuildPipeline.BuildPlayer started");
            var result = BuildPipeline.BuildPlayer(levels.ToArray(), exePathName, target, opts);
            GameDebug.Log("BuildPipeline.BuildPlayer ended. Duration:" + (DateTime.Now - time).TotalSeconds + "s");

            Environment.SetEnvironmentVariable("BUILD_ID", "", EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable("BUILD_UNITY_VERSION", "", EnvironmentVariableTarget.Process);

            Debug.Log(" ==== Build Done =====");

            var stepCount = result.steps.Count();
            Debug.Log(" Steps:" + stepCount);
            for (var i = 0; i < stepCount; i++)
            {
                var step = result.steps[i];
                Debug.Log("-- " + (i + 1) + "/" + stepCount + " " + step.name + " " + step.duration.Seconds + "s --");
                foreach (var msg in step.messages)
                {
                    Debug.Log(msg.content);
                }
            }

            return(result);
        }
    }
示例#27
0
 public void OnGUI()
 {
     EditorUpdateWindow.LoadResources();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     GUILayout.Space(10f);
     GUI.Box(new Rect(13f, 8f, (float)EditorUpdateWindow.s_UnityLogo.image.width, (float)EditorUpdateWindow.s_UnityLogo.image.height), EditorUpdateWindow.s_UnityLogo, GUIStyle.none);
     GUILayout.Space(5f);
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(120f);
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     if (EditorUpdateWindow.s_HasConnectionError)
     {
         GUILayout.Label(EditorUpdateWindow.s_ErrorString, "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(405f)
         });
     }
     else if (EditorUpdateWindow.s_HasUpdate)
     {
         GUILayout.Label(string.Format(EditorUpdateWindow.s_TextHasUpdate.text, InternalEditorUtility.GetFullUnityVersion(), EditorUpdateWindow.s_LatestVersionString), "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(300f)
         });
         GUILayout.Space(20f);
         this.m_ScrollPos = EditorGUILayout.BeginScrollView(this.m_ScrollPos, new GUILayoutOption[]
         {
             GUILayout.Width(405f),
             GUILayout.Height(200f)
         });
         GUILayout.Label(EditorUpdateWindow.s_LatestVersionMessage, "WordWrappedLabel", new GUILayoutOption[0]);
         EditorGUILayout.EndScrollView();
         GUILayout.Space(20f);
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         if (GUILayout.Button("Download new version", new GUILayoutOption[]
         {
             GUILayout.Width(200f)
         }))
         {
             Help.BrowseURL(EditorUpdateWindow.s_UpdateURL);
         }
         if (GUILayout.Button("Skip new version", new GUILayoutOption[]
         {
             GUILayout.Width(200f)
         }))
         {
             EditorPrefs.SetString("EditorUpdateSkipVersionString", EditorUpdateWindow.s_LatestVersionString);
             base.Close();
         }
         GUILayout.EndHorizontal();
     }
     else
     {
         GUILayout.Label(string.Format(EditorUpdateWindow.s_TextUpToDate.text, Application.unityVersion), "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(405f)
         });
     }
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     GUILayout.Space(8f);
     GUILayout.FlexibleSpace();
     GUILayout.BeginHorizontal(new GUILayoutOption[]
     {
         GUILayout.Height(20f)
     });
     GUILayout.FlexibleSpace();
     GUI.changed = false;
     EditorUpdateWindow.s_ShowAtStartup = GUILayout.Toggle(EditorUpdateWindow.s_ShowAtStartup, EditorUpdateWindow.s_CheckForNewUpdatesText, new GUILayoutOption[0]);
     if (GUI.changed)
     {
         EditorPrefs.SetBool("EditorUpdateShowAtStartup", EditorUpdateWindow.s_ShowAtStartup);
     }
     GUILayout.Space(10f);
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }