Exemplo n.º 1
0
 public static bool ExportSceneResource(string customNamespace = null)
 {
     //IL_0015: Unknown result type (might be due to invalid IL or missing references)
     //IL_004e: Unknown result type (might be due to invalid IL or missing references)
     //IL_005f: Unknown result type (might be due to invalid IL or missing references)
     PipelineManager[] array = Object.FindObjectsOfType <PipelineManager>();
     if (array.Length > 0)
     {
         PipelineManager val = array[0];
         val.contentType = 1;
         if (string.IsNullOrEmpty(val.blueprintId))
         {
             val.AssignId();
         }
         EditorPrefs.SetString("lastBuiltAssetBundleBlueprintID", val.blueprintId);
         EditorUtility.SetDirty(array[0]);
         EditorSceneManager.MarkSceneDirty(val.get_gameObject().get_scene());
         EditorSceneManager.SaveScene(val.get_gameObject().get_scene());
     }
     if (CustomDLLMaker.CustomScriptsAvailable())
     {
         ExportCurrentSceneResourceWithPlugin(customNamespace);
         return(true);
     }
     CustomDLLMaker.ClearSavedPluginPrefs();
     AssetExporter.ExportCurrentSceneResource();
     return(false);
 }
Exemplo n.º 2
0
 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");
             }
         }
     }
 }