SketchUpImporter.GetScenes

Unity · Версия 2020.3 LTS · Scripting · SketchUpImporter

SketchUpImporter.GetScenes

Объявление

public SketchUpImportScene[] GetScenes();

Возвращает

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 SketchUpImporterSketchUpImporter 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);
        }
    }
}

В приведенном выше примере используется GameObject, импортированный из файла SketchUp, и печатаются названия сцен из файла SketchUp.

Обновлено 17 ноября 2026 г.