ScriptProxy Class |
Namespace: UMod.Scripting
public class ScriptProxy : IDisposable
The ScriptProxy type exposes the following members.
Name | Description | |
---|---|---|
BehaviourInstance |
Get the instance of the script as a MonoBehaviour.
This property will return null if the wrapped type does not inherit from MonoBehaviour.
| |
Fields |
Returns the IScriptMemberProxy that provides access to the fields of the wrapped type.
| |
Instance |
Get the instance of the script as an object.
Use this property to access the managed instance.
| |
IsDisposed |
Returns true if the proxy has been disposed.
Be careful, the proxy can become disposed automatically if the managed type is destroyed by Unity.
This can occur during scene changes for MonoBehaviour components and cause the proxy to become invalid.
If you want to make sure the wrapped type is not dispoed automatically then you can call MakePersistent.
| |
IsMonoBehaviour |
Returns true if the managed type inherits from MonoBehaviour.
This is equivilent of calling IsMonoBehaviour.
| |
IsScriptableObject |
Returns true if the managed type inherits from ScriptableObject.
This is equivilent of calling IsScriptableObject.
| |
IsUnityObject |
Returns true if the ScriptType inherits from Object.
If this value is true then it is safe to cast this proxy into a ScriptProxy for Unity specific operations.
| |
Properties |
Returns the IScriptMemberProxy that provides access to the properties of the wrapped type.
| |
SafeFields | ||
SafeProperties | ||
ScriptableInstance |
Get the instance of the script as a ScriptableObject.
This property will return null if the wrapped type does not inherit from ScriptableObject.
| |
ScriptType |
Get the ScriptType of this proxy object.
| |
UnityInstance |
Access the wrapped instance as a unity Object.
|
Name | Description | |
---|---|---|
Call(String) |
Attempt to call a method on the managed type with the specified name.
This works in a similar way as SendMessage(String) where the method name is specified.
The target method must not accept any arguments.
| |
Call(String, Object) |
Attempt to call a method on the managed type with the specified name and arguments.
This works in a similar was as SendMessage(String) where the method name is specified.
Any number of arguments may be specified but the target method must expect the arguments.
| |
Call(String, ProxyCallConvention) |
Attempt to call a method on the managed instance with the specified name.
This works in a similar way as SendMessage(String) where the method name is specified.
The target method must not accept any arguments.
| |
Call(String, ProxyCallConvention, Object) |
Attempt to call a method on the managed instance with the specified name and arguments.
This works in a similar was as SendMessage(String) where the method name is specified.
Any number of arguments may be specified but the target method must expect the arguments.
| |
Dispose |
Dispose of the proxy and its managed script instance.
Once disposed, the proxy should never be accessed again.
Only call this method once you are sure you will never need the instance again.
| |
GetInstanceAsT |
Attempts to get the managed instance as the specified generic type.
| |
GetInstanceType |
Get the system type of the managed script type.
| |
MakePersistent |
If the managed object is a Unity type then this method will call 'DontDestroyOnLoad' to ensure that the object is able to survie scene loads.
| |
SafeCall(String) |
Attempt to call a method on the managed type with the specified name.
Any exceptions thrown as a result of location or calling the method will be caught silently.
This works in a similar was as SendMessage(String) where the target method name is specified.
The target method must not accept any arguments.
| |
SafeCall(String, Object) |
Attempt to call a method on the managed type with the specified name.
Any exceptions thrown as a result of location or calling the method will be caught silently.
This works in a similar was as SendMessage(String) where the target method name is specified.
Any number of arguments may be specified but the target method must expect the arguments.
| |
SafeCall(String, ProxyCallConvention) |
Attempt to call a method on the managed instance with the specified name.
Any exceptions thrown as a result of locating or calling the method will be caught silently.
This works in a similar was as SendMessage(String) where the target method name is specified.
The target method must not accept any arguments.
| |
SafeCall(String, ProxyCallConvention, Object) |
Attempt to call a method on the managed instance with the specified name.
Any exceptions thrown as a result of locating or calling the method will be caught silently.
This works in a similar was as SendMessage(String) where the target method name is specified.
Any number of arguments may be specified but the target method must expect the arguments.
|