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