public SketchUpImportScene[] GetScenes ();

Returns

SketchUpImportScene[] 提取自 SketchUp 文件的场景的数组。

Description

此方法会返回表示 SketchUp 场景的 SketchUpImportScene 的数组。

SketchUpImportScene is the structure to represent the Scene that was extracted from the SketchUp file.

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 文件导入的游戏对象为例,并打印 SketchUp 文件中场景的名称。