コード例 #1
0
        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);
        }