# OnPreprocessCameraDescription(CameraDescription, Camera, AnimationClip[])

> Add this function to a subclass to receive a notification when a camera is imported from a Model Importer.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)

## OnPreprocessCameraDescription()

```csharp
public void OnPreprocessCameraDescription(CameraDescription cameraDescription, Camera camera, AnimationClip[] animationClip)
```

### Parameters

**** (CameraDescription): **** (\[Camera]\(/engine/6000.3/script-reference/unityengine/camera)): **** (\[AnimationClip\[]]\(/engine/6000.3/script-reference/unityengine/animation/clip)):&#x20;

### Remarks

Unity only calls this function when [ModelImporter.importCameras](/engine/6000.3/script-reference/unityeditor/modelimporter/importcameras.md) is true. This function gives you control over camera properties and animations during the model import process. The [CameraDescription](/engine/6000.3/script-reference/unityeditor/assetimporters/cameradescription.md) structure contains all the camera data from the imported file. You can use it to populate the camera, its GameObject, and animation clips.

### Examples

```csharp

// The following code example shows how Unity uses this function to set up a perspective camera from an imported FBX file.


using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEditor.AssetImporters;

public class SetupCameraFromCameraDescription : AssetPostprocessor
{
    // Increment the version number, when the AssetPostprocessors code/behavior is changed
    static readonly uint k_Version = 0;
    public override uint GetVersion() { return k_Version; }

    // Film back dimensions are in inches, but focal lengths are in millimeters.
    const float k_InchToMm = 25.4f;

    void OnPreprocessCameraDescription(CameraDescription description, Camera camera, AnimationClip[] clips)
    {
        var modelImporter = assetImporter as ModelImporter;
        var globalScale = modelImporter.globalScale;

        description.TryGetProperty("NearPlane", out float nearPlane);
        description.TryGetProperty("FarPlane", out float farPlane);
        description.TryGetProperty("ApertureMode", out int apertureMode);
        description.TryGetProperty("FilmWidth", out float filmWidth);
        description.TryGetProperty("FilmHeight", out float filmHeight);
        description.TryGetProperty("FocalLength", out float focalLength);

        if (nearPlane >= 0)
            camera.nearClipPlane = nearPlane * globalScale;
        if (farPlane >= 0)
            camera.farClipPlane = farPlane * globalScale;

        float fov = 0;
        switch (apertureMode)
        {
            case 0:
                description.TryGetProperty("FieldOfViewY", out fov);
                camera.fieldOfView = fov;
                break;
            case 1:
                description.TryGetProperty("FieldOfView", out float alphaH);
                alphaH /= 2;
                float focal = (filmWidth * k_InchToMm) / 2 / Mathf.Tan(alphaH * Mathf.Deg2Rad);
                float alphaV = Mathf.Atan((filmHeight * k_InchToMm) / 2 / focal) * Mathf.Rad2Deg;
                camera.fieldOfView = alphaV * 2;
                break;
            case 2:
                description.TryGetProperty("FieldOfView", out fov);
                camera.fieldOfView = fov;
                break;
            case 3:

                if (focalLength != .0f)
                {
                    float apertureWidth = filmHeight * k_InchToMm;
                    fov = Mathf.Atan((apertureWidth / focalLength) * 0.5f) * 2.0f * Mathf.Rad2Deg;
                }
                break;
        }

        camera.fieldOfView = fov;
    }
}
```
