Exemple #1
0
        public static int GetAssetBundleSizeLimit(ContentType contentType)
        {
            //IL_0002: Unknown result type (might be due to invalid IL or missing references)
            //IL_0008: Invalid comparison between Unknown and I4
            bool flag = true;

            if ((int)EditorUserBuildSettings.get_selectedBuildTargetGroup() != 1)
            {
                switch (contentType)
                {
                case ContentType.World:
                    return(CONTENT_WORLD_ASSET_BUNDLE_SIZE_LIMIT_MOBILE);

                case ContentType.Avatar:
                    return(CONTENT_AVATAR_ASSET_BUNDLE_SIZE_LIMIT_MOBILE);

                default:
                    return(-1);
                }
            }
            switch (contentType)
            {
            case ContentType.World:
                return(CONTENT_WORLD_ASSET_BUNDLE_SIZE_LIMIT_PC);

            case ContentType.Avatar:
                return(CONTENT_AVATAR_ASSET_BUNDLE_SIZE_LIMIT_PC);

            default:
                return(-1);
            }
        }
Exemple #2
0
        public static bool IsMobilePlatform()
        {
            //IL_0002: Unknown result type (might be due to invalid IL or missing references)
            //IL_0008: Invalid comparison between Unknown and I4
            bool flag = true;

            flag = ((int)EditorUserBuildSettings.get_selectedBuildTargetGroup() == 1);
            return(!flag);
        }
 private static void ExportCurrentAvatarResource(GameObject avatarResource = null)
 {
     //IL_009b: Unknown result type (might be due to invalid IL or missing references)
     //IL_00ed: Unknown result type (might be due to invalid IL or missing references)
     //IL_00fe: Unknown result type (might be due to invalid IL or missing references)
     //IL_0180: Unknown result type (might be due to invalid IL or missing references)
     //IL_01e6: Unknown result type (might be due to invalid IL or missing references)
     //IL_01eb: Unknown result type (might be due to invalid IL or missing references)
     //IL_01ed: Unknown result type (might be due to invalid IL or missing references)
     //IL_01f2: Unknown result type (might be due to invalid IL or missing references)
     //IL_0206: Unknown result type (might be due to invalid IL or missing references)
     //IL_0208: Unknown result type (might be due to invalid IL or missing references)
     //IL_020e: Unknown result type (might be due to invalid IL or missing references)
     //IL_024d: Unknown result type (might be due to invalid IL or missing references)
     //IL_024f: Unknown result type (might be due to invalid IL or missing references)
     if (avatarResource != null)
     {
         Selection.set_activeObject(avatarResource);
     }
     vrcPath = null;
     if (Selection.get_activeObject() == null)
     {
         EditorUtility.DisplayDialog("Build Custom Avatar", "You must select the avatar root gameobject you want to build.", "Ok");
     }
     else
     {
         VRC_AvatarDescriptor component = (Selection.get_activeObject() as GameObject).GetComponent <VRC_AvatarDescriptor>();
         if (component == null)
         {
             EditorUtility.DisplayDialog("Build Custom Avatar", "You must place a VRC_AvatarDescriptor on the root of you custom scene", "Ok");
         }
         else
         {
             component.unityVersion = Application.get_unityVersion();
             EditorUtility.SetDirty(component);
             PipelineManager component2 = component.get_gameObject().GetComponent <PipelineManager>();
             if (component2 != null)
             {
                 component2.contentType = 0;
                 if (string.IsNullOrEmpty(component2.blueprintId))
                 {
                     component2.AssignId();
                 }
                 EditorPrefs.SetString("lastBuiltAssetBundleBlueprintID", component2.blueprintId);
                 EditorUtility.SetDirty(component2);
                 EditorSceneManager.MarkSceneDirty(component2.get_gameObject().get_scene());
                 EditorSceneManager.SaveScene(component2.get_gameObject().get_scene());
                 GameObject val = Object.Instantiate(Selection.get_activeObject()) as GameObject;
                 RemoveEditorOnlyElementsFromObject(val);
                 PrefabUtility.CreatePrefab("Assets/_CustomAvatar.prefab", val);
                 Object.DestroyImmediate(val);
                 if (shouldBuildUnityPackage)
                 {
                     List <string> list = new List <string>();
                     list.Add("Assets/_CustomAvatar.prefab");
                     string dstPath = Application.get_dataPath() + "/../" + Selection.get_activeObject().get_name() + ".unitypackage";
                     AssetExporter.ExportCurrentAssetAsUnityPackage(list, dstPath);
                 }
                 else
                 {
                     AssetExporter.CleanupUnityPackageExport();
                 }
                 AssetBundleBuild val2 = default(AssetBundleBuild);
                 val2.assetNames = new string[1]
                 {
                     "Assets/_CustomAvatar.prefab"
                 };
                 val2.assetBundleName = "customAvatar.unity3d";
                 val2.assetBundleName = val2.assetBundleName.ToLower();
                 string sourceFileName = Application.get_temporaryCachePath() + "/" + val2.assetBundleName;
                 vrcPath = Application.get_temporaryCachePath() + "/custom.vrca";
                 BuildTargetGroup selectedBuildTargetGroup = EditorUserBuildSettings.get_selectedBuildTargetGroup();
                 BuildTarget      activeBuildTarget        = EditorUserBuildSettings.get_activeBuildTarget();
                 BuildPipeline.BuildAssetBundles(Application.get_temporaryCachePath(), (AssetBundleBuild[])new AssetBundleBuild[1]
                 {
                     val2
                 }, 0, EditorUserBuildSettings.get_activeBuildTarget());
                 if (File.Exists(vrcPath))
                 {
                     File.Delete(vrcPath);
                 }
                 File.Move(sourceFileName, vrcPath);
                 EditorPrefs.SetString("currentBuildingAssetBundlePath", vrcPath);
                 EditorUserBuildSettings.SwitchActiveBuildTarget(selectedBuildTargetGroup, activeBuildTarget);
                 AssetDatabase.DeleteAsset("Assets/_CustomAvatar.prefab");
                 AssetDatabase.Refresh();
                 VRC_Editor.RecordActivity("avatar", Path.GetFileName(vrcPath));
             }
             else
             {
                 EditorUtility.DisplayDialog("Could not find PipelineManager", "Your scene does not contain a PipelineManager. It should be auto added by the AvatarDescriptor.", "Ok");
             }
         }
     }
 }
Exemple #4
0
        public static void ExportCurrentSceneResource()
        {
            //IL_001e: Unknown result type (might be due to invalid IL or missing references)
            //IL_0023: Unknown result type (might be due to invalid IL or missing references)
            //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
            //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
            //IL_00e7: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
            //IL_0104: Unknown result type (might be due to invalid IL or missing references)
            //IL_0109: Unknown result type (might be due to invalid IL or missing references)
            //IL_017f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0184: Unknown result type (might be due to invalid IL or missing references)
            //IL_0186: Unknown result type (might be due to invalid IL or missing references)
            //IL_018b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0193: Unknown result type (might be due to invalid IL or missing references)
            //IL_019e: Unknown result type (might be due to invalid IL or missing references)
            //IL_01a0: Unknown result type (might be due to invalid IL or missing references)
            object text;

            if (EditorPrefs.HasKey("originalScenePath"))
            {
                text = EditorPrefs.GetString("originalScenePath");
            }
            else
            {
                Scene activeScene = SceneManager.GetActiveScene();
                text = activeScene.get_path();
            }
            string path = (string)text;
            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
            string text2 = null;

            VRC_SceneDescriptor[] array = Tools.FindSceneObjectsOfTypeAll <VRC_SceneDescriptor>();
            if (array == null || array.Length != 1)
            {
                EditorUtility.DisplayDialog("Build Custom Scene", "Scene needs exactly one VRC_SceneDescriptor", "Ok");
            }
            else
            {
                VRC_SceneDescriptor val = array[0];
                if (val == null)
                {
                    EditorUtility.DisplayDialog("Build Custom Scene", "You must place a VRC_SceneDescriptor on the root of you custom scene", "Ok");
                }
                else if (val.spawns.Length < 1)
                {
                    EditorUtility.DisplayDialog("Build Custom Scene", "You must add at least one spawn to spawns in your VRC_SceneDescriptor.", "Ok");
                }
                else
                {
                    FindDynamicContent(val);
                    val.gravity           = Physics.get_gravity();
                    val.layerCollisionArr = UpdateLayers.GetLayerCollisionArray();
                    val.unityVersion      = Application.get_unityVersion();
                    EditorUtility.SetDirty(val);
                    EditorSceneManager.MarkSceneDirty(val.get_gameObject().get_scene());
                    EditorSceneManager.SaveScene(val.get_gameObject().get_scene());
                    try
                    {
                        Scene  activeScene2 = SceneManager.GetActiveScene();
                        string text3        = activeScene2.get_path();
                        string text4        = fileNameWithoutExtension;
                        bool   flag         = false;
                        if (text4.Contains("."))
                        {
                            flag = true;
                            string text5 = "Assets/customTmpScene12345.unity";
                            AssetDatabase.CopyAsset(text3, text5);
                            text3 = text5;
                            AssetDatabase.Refresh();
                        }
                        AssetDatabase.RemoveUnusedAssetBundleNames();
                        string        text6  = "customscene.vrcw";
                        AssetImporter atPath = AssetImporter.GetAtPath(text3);
                        atPath.set_assetBundleName(text6);
                        atPath.SaveAndReimport();
                        text2 = Application.get_temporaryCachePath() + "/" + text6;
                        BuildTarget      activeBuildTarget        = EditorUserBuildSettings.get_activeBuildTarget();
                        BuildTargetGroup selectedBuildTargetGroup = EditorUserBuildSettings.get_selectedBuildTargetGroup();
                        BuildPipeline.BuildAssetBundles(Application.get_temporaryCachePath(), 0, EditorUserBuildSettings.get_activeBuildTarget());
                        EditorUserBuildSettings.SwitchActiveBuildTarget(selectedBuildTargetGroup, activeBuildTarget);
                        EditorPrefs.SetString("currentBuildingAssetBundlePath", text2);
                        EditorPrefs.SetString("lastVRCPath", text2);
                        atPath.set_assetBundleName(string.Empty);
                        atPath.SaveAndReimport();
                        if (flag)
                        {
                            AssetDatabase.DeleteAsset(text3);
                        }
                        AssetDatabase.RemoveUnusedAssetBundleNames();
                    }
                    catch (Exception ex)
                    {
                        Debug.LogError((object)("Export Exception - " + ex.ToString()));
                        throw ex;
                        IL_0205 :;
                    }
                    if (text2 != null)
                    {
                        VRC_Editor.RecordActivity("scene", Path.GetFileName(text2));
                    }
                }
            }
        }