SketchUpImportScene[] 从 SketchUp 文件中提取的场景数组。
此方法返回一个 SketchUpImportScene 数组,它代表 SketchUp 场景。
SketchUpImportScene 是用于表示从 SketchUp 文件中提取的场景的结构。
using UnityEngine; using UnityEditor;
public class SketchUpUtility { public static void PrintSketchUpSceneName(GameObject go) { string assetPath = AssetDatabase.GetAssetPath(go); // get asset path // get SketchUpImporter SketchUpImporter importer = AssetImporter.GetAtPath(assetPath) as SketchUpImporter; if (importer == null) { Debug.Log("This object is not imported by SketchUpImporter"); return; }
SketchUpImportScene[] scenes = importer.GetScenes(); // get all the scenes
foreach (SketchUpImportScene scene in scenes) { Debug.Log(scene.name); } } }
上面的示例采用从 SketchUp 文件导入的 GameObject,并打印 SketchUp 文件中场景的名称。