Description
The DispatchPreEdited
method is a static extension method provided by the Editor.SceneEditorExtensions
class. It is used to trigger an event or perform an action before a serialized property is edited in the scene editor. This method is particularly useful for handling pre-editing logic, such as validation or preparation tasks, before the actual editing of the property takes place.
Usage
To use the DispatchPreEdited
method, you need to pass a Sandbox.SerializedProperty
object as a parameter. This object represents the property that is about to be edited. The method does not return any value.
Ensure that the Sandbox.SerializedProperty
you pass is valid and properly initialized before calling this method.
Example
// Example usage of DispatchPreEdited
// Assume 'property' is a valid SerializedProperty object
Sandbox.SerializedProperty property = GetSerializedProperty();
// Call the DispatchPreEdited method
Editor.SceneEditorExtensions.DispatchPreEdited(property);
// Function to retrieve a SerializedProperty (for demonstration purposes)
Sandbox.SerializedProperty GetSerializedProperty()
{
// Logic to obtain and return a SerializedProperty
return new Sandbox.SerializedProperty();
}