public static GameObject CreateSceneCachePlayerPrefab(string path) { GameObject go = CreateSceneCachePlayer(path); if (go == null) { return(null); } // export materials & animation and generate prefab SceneCachePlayer player = go.GetComponent <SceneCachePlayer>(); player.UpdatePlayer(); player.ExportMaterials(false, true); player.ResetTimeAnimation(); player.handleAssets = false; SceneData scene = player.GetLastScene(); if (!scene.submeshesHaveUniqueMaterial) { MeshSyncPlayerConfig config = player.GetConfig(); config.SyncMaterialList = false; } string prefabPath = string.Format("Assets/SceneCache/{0}.prefab", go.name); PrefabUtility.SaveAsPrefabAssetAndConnect(go, prefabPath, InteractionMode.AutomatedAction); return(go); }
public override void OnInspectorGUI() { var so = serializedObject; SceneCachePlayer t = target as SceneCachePlayer; EditorGUILayout.Space(); DrawCacheSettings(t, so); DrawPlayerSettings(t, so); MeshSyncPlayerConfig config = t.GetConfig(); if (config.Profiling) { EditorGUILayout.TextArea(t.dbgProfileReport, GUILayout.Height(120)); EditorGUILayout.Space(); } DrawMaterialList(t); DrawTextureList(t); DrawAnimationTweak(t); DrawExportAssets(t); DrawPluginVersion(); so.ApplyModifiedProperties(); }