Version: 2023.1
public SketchUpImportCamera GetDefaultCamera ();

返回

SketchUpImportCamera 默认摄像机。

描述

默认摄像机或随 SketchUp 文件一起保存的活动场景的摄像机。

以下示例显示了如何提取默认摄像机并记录该摄像机是否是存储在 SketchUpImportCamera 中的透视摄像机。

using UnityEngine;
using UnityEditor;

public class SketchUpUtility { public static void IsDefaultCameraPerspective(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; }

SketchUpImportCamera camera = importer.GetDefaultCamera(); // get all the scenes

Debug.Log("The default camera is " + (camera.isPerspective ? "perspective" : "orthogonal")); } }