Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

SketchUpImporter.GetDefaultCamera

Switch to Manual
public function GetDefaultCamera(): SketchUpImportCamera;

Returns

SketchUpImportCamera The default camera.

Description

The default camera or the camera of the active scene which the SketchUp file was saved with.

The following is an example of extracting the default camera and logging if the camera is a perspective camera stored in SketchUpImportCamera.

#pragma strict
public class SketchUpUtility {
	public static function IsDefaultCameraPerspective(go: GameObject) {
		var assetPath: String = AssetDatabase.GetAssetPath(go);
		// get SketchUpImporter
		var importer: SketchUpImporter = AssetImporter.GetAtPath(assetPath) as SketchUpImporter;
		if (importer == null) {
			Debug.Log("This object is not imported by SketchUpImporter");
			return ;
		}
		var camera: SketchUpImportCamera = importer.GetDefaultCamera();
		// get all the scenes
		Debug.Log("The default camera is " + (camera.isPerspective == 1 ? "perspective" : "orthogonal"));
	}
}