Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SceneImportContext

Additional import context for scene assets used in AssetPostprocessor.OnProcessScene(Scene, SceneImportContext).
Read time 1 minuteLast updated 10 days ago

Definition

public struct SceneImportContext

Remarks

Unity passes an instance of this struct to AssetPostprocessor.OnProcessScene(Scene, SceneImportContext) for every scene it processes during a Player build or in Play mode.
The following example logs a message when a scene is processed while Awake has been called before the callback.

Examples

using UnityEditor;using UnityEditor.Build.Content;using UnityEngine;using UnityEngine.SceneManagement;class MySceneProcessor : AssetPostprocessor{ public void OnProcessScene(Scene scene, SceneImportContext sceneContext) { if (sceneContext.awakeDidRun) Debug.Log($"Processing {scene.name} with Awake already called."); }}

Properties

Property

Description

awakeDidRunIndicates whether Unity has already called Awake on the objects in the scene.
loadingReasonIndicates the reason for which the scene is being loaded.