static System.IDisposable Scope( string path, Transform tx )
static System.IDisposable Scope( string path, Vector3 position )
static System.IDisposable Scope( string path, Vector3 position, Rotation rotation, float scale )
static System.IDisposable Scope( string path )

book_4_sparkGenerated
code_blocksInput

Description

The Gizmo.Scope method is a static method in the Sandbox.Gizmo class that creates a scoped context for drawing gizmos. This method returns an IDisposable object, which allows for the use of a using statement to ensure that resources are properly disposed of after use. This particular overload of the Scope method takes a file path and a Transform object as parameters.

Usage

To use the Gizmo.Scope method, you should wrap it in a using statement. This ensures that the resources are automatically disposed of when the scope is exited. The method is useful for setting up a temporary context for drawing gizmos, which can be particularly helpful in debugging or visualizing transformations in a scene.

Parameters:

  • path (String): The file path associated with the gizmo scope. This can be used to identify or categorize the gizmo being drawn.
  • tx (Transform): The transformation to apply to the gizmo. This includes position, rotation, and scale information.

Example

// Example of using Gizmo.Scope with a Transform

Transform myTransform = new Transform();
myTransform.Position = new Vector3(0, 0, 0);
myTransform.Rotation = Rotation.Identity;
myTransform.Scale = 1.0f;

using (var scope = Gizmo.Scope("MyGizmoPath", myTransform))
{
    // Draw your gizmo here
    // The gizmo will be drawn with the specified transform
}