Description
The OnFrameTo
property in the SceneEditorSession
class is an event handler that allows you to define a custom action to be executed when the scene editor frames to a specific bounding box (BBox
). This property is of type System.Action<BBox>
, meaning it takes a BBox
as a parameter and returns no value.
Usage
To use the OnFrameTo
property, assign a method or lambda expression that matches the Action<BBox>
delegate signature. This method will be called whenever the scene editor needs to frame to a specific bounding box.
For example, you might use this to update the camera position or perform other actions when the editor focuses on a particular area of the scene.
Example
// Example of using the OnFrameTo property
// Define a method that matches the Action<BBox> signature
void FrameToHandler(BBox box)
{
// Custom logic to handle framing to the specified bounding box
// For example, adjust the camera position
Camera.Main.Position = box.Center;
}
// Assign the method to the OnFrameTo property
SceneEditorSession session = new SceneEditorSession();
session.OnFrameTo = FrameToHandler;
// Alternatively, use a lambda expression
session.OnFrameTo = (box) => {
// Custom logic here
Camera.Main.Position = box.Center;
};