Class Object
Base class for all objects Flax can reference. Every object has unique identifier.
Inheritance
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
public abstract class Object : Object
Constructors
Object()
Fields
__internalId
The object unique identifier.
Declaration
protected readonly Guid __internalId
Field Value
System.Guid
|
__unmanagedPtr
The pointer to the unmanaged object (native C++ instance).
Declaration
protected readonly IntPtr __unmanagedPtr
Field Value
System.IntPtr
|
Properties
ID
Gets the unique object ID.
Declaration
public Guid ID { get; }
Property Value
System.Guid
|
TypeName
Gets a full name of the object type including leading namespace and any nested types names. Uniquely identifies the object type and can be used to find it via name.
Declaration
public string TypeName { get; }
Property Value
System.String
|
Methods
As<T>()
Casts this object instance to the given object type.
Declaration
public T As<T>()
where T : Actor
Returns
T
The object instance cast to the given actor type. |
Type Parameters
T
object actor type. |
Destroy(Object, Single)
Destroys the specified object and clears the reference variable. The object obj will be destroyed now or after the time specified in seconds from now. If obj is a Script it will be removed from the Actor and deleted. If obj is an Actor it will be removed from the Scene and deleted as well as all its Scripts and all children of the Actor. Actual object destruction is always delayed until after the current Update loop, but will always be done before rendering.
Declaration
public static void Destroy(Object obj, float timeLeft = 0F)
Parameters
Object
obj
The object to destroy. |
System.Single
timeLeft
The time left to destroy object (in seconds). |
Destroy<T>(ref T, Single)
Destroys the specified object and clears the reference variable. The object obj will be destroyed now or after the time specified in seconds from now. If obj is a Script it will be removed from the Actor and deleted. If obj is an Actor it will be removed from the Scene and deleted as well as all its Scripts and all children of the Actor. Actual object destruction is always delayed until after the current Update loop, but will always be done before rendering.
Declaration
public static void Destroy<T>(ref T obj, float timeLeft = 0F)
where T : Object
Parameters
T
obj
The object to destroy. |
System.Single
timeLeft
The time left to destroy object (in seconds). |
Type Parameters
T
|
DestroyNow(Object)
Destroys the specified object and clears the reference variable. The object obj will be destroyed immediately. If obj is a Script it will be removed from the Actor and deleted. If obj is an Actor it will be removed from the Scene and deleted as well as all its Scripts and all children of the Actor.
Declaration
public static void DestroyNow(Object obj)
Parameters
Object
obj
The object to destroy. |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
|
Returns
System.Boolean
|
Finalize()
Notifies the unmanaged interop object that the managed instance was finalized.
Declaration
protected override void Finalize()
Find(ref Guid, Type, Boolean)
Finds the object with the given ID. Searches registered scene objects and assets.
Declaration
public static Object Find(ref Guid id, Type type, bool skipLog = false)
Parameters
System.Guid
id
Unique ID of the object. |
System.Type
type
Type of the object. |
System.Boolean
skipLog
Whether or not to log warnings when objects aren't found. |
Returns
Object
Found object or null if missing. |
Find<T>(ref Guid, Boolean)
Finds the object with the given ID. Searches registered scene objects and assets.
Declaration
public static T Find<T>(ref Guid id, bool skipLog = false)
where T : Object
Parameters
System.Guid
id
Unique ID of the object. |
System.Boolean
skipLog
Whether or not to log warnings when objects aren't found. |
Returns
T
Found object or null if missing. |
Type Parameters
T
Type of the object. |
FromUnmanagedPtr(IntPtr)
Gets the managed object from the native object pointer.
Declaration
public static Object FromUnmanagedPtr(IntPtr ptr)
Parameters
System.IntPtr
ptr
The pointer to the unmanaged (native) object. |
Returns
Object
The object. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
System.Int32
|
GetUnmanagedInterface(Object, Type)
Gets the pointer to the native interface implementation. Handles null object reference or invalid cast (returns zero).
Declaration
public static IntPtr GetUnmanagedInterface(object obj, Type type)
Parameters
System.Object
obj
The object. |
System.Type
type
The interface type. |
Returns
System.IntPtr
The native interface pointer. |
GetUnmanagedPtr(Object)
Gets the pointer to the native object. Handles null object reference (returns zero).
Declaration
public static IntPtr GetUnmanagedPtr(Object obj)
Parameters
Object
obj
The object. |
Returns
System.IntPtr
The native object pointer. |
MapObjectID(ref Guid)
Maps the object ID using the current Scripting::ObjectsLookupIdMapping (key to value). Used to map prefab object IDs into prefab instance object IDs, or when using network replication IDs table.
Declaration
public static void MapObjectID(ref Guid id)
Parameters
System.Guid
id
Inout object identifier mapped as a result or unchanged if not mapped. |
New(String)
Creates the new instance of the Object. All unused objects should be released using Destroy(Object, Single).
Declaration
public static Object New([TypeReference] string typeName)
Parameters
System.String
typeName
Full name of the type of the object. |
Returns
Object
Created object. |
NewValue(Type)
Creates the new instance of the C# object.
Declaration
public static object NewValue([TypeReference] Type type)
Parameters
System.Type
type
Type of the object. |
Returns
System.Object
Created object. |
RemapObjectID(ref Guid)
Remaps the object ID using the current Scripting::ObjectsLookupIdMapping (value to key). Used to remap prefab instance IDs into prefab object IDs, or when using network replication IDs table.
Declaration
public static void RemapObjectID(ref Guid id)
Parameters
System.Guid
id
Inout object identifier mapped as a result or unchanged if not mapped. |
TryFind(ref Guid, Type)
Tries to find the object by the given identifier. Searches only registered scene objects.
Declaration
public static Object TryFind(ref Guid id, Type type)
Parameters
System.Guid
id
Unique ID of the object. |
System.Type
type
Type of the object. |
Returns
Object
Found object or null if missing. |
TryFind<T>(ref Guid)
Tries to find the object by the given identifier. Searches only registered scene objects.
Declaration
public static T TryFind<T>(ref Guid id)
where T : Object
Parameters
System.Guid
id
Unique ID of the object. |
Returns
T
Found object or null if missing. |
Type Parameters
T
Type of the object. |
Operators
Equality(Object, Object)
Checks whether the two objects are equal.
Declaration
public static bool operator ==(Object left, Object right)
Parameters
Object
left
|
Object
right
|
Returns
System.Boolean
|
Implicit(Object to Boolean)
Checks if the object exists (reference is not null and the unmanaged object pointer is valid).
Declaration
public static implicit operator bool (Object obj)
Parameters
Object
obj
The object to check. |
Returns
System.Boolean
True if object is valid, otherwise false. |
Inequality(Object, Object)
Checks whether the two objects are not equal.
Declaration
public static bool operator !=(Object left, Object right)
Parameters
Object
left
|
Object
right
|
Returns
System.Boolean
|