Description
The Invoke
method in the SerializedProperty
class is used to execute the method associated with the serialized property. This method is virtual, allowing derived classes to provide their own implementation if necessary. It is typically used when the serialized property represents a method that needs to be called.
Usage
To use the Invoke
method, ensure that the SerializedProperty
instance represents a method. You can check this by verifying the IsMethod
property of the SerializedProperty
. If it returns true
, you can safely call Invoke
to execute the method.
Example
// Assuming 'property' is an instance of SerializedProperty
if (property.IsMethod)
{
property.Invoke();
}