Photon Fusion 2.0.0

Static Public Member Functions | List of all members
ReflectionUtils Class Reference

Provides utility methods for reflection. More...

Static Public Member Functions

static IEnumerable< Type > GetAllNetworkBehaviourTypes ()
 Gets all types that are assignable from NetworkBehaviour from all assemblies.
 
static IEnumerable< Type > GetAllSimulationBehaviourTypes ()
 Gets all types that are assignable from SimulationBehaviour from all assemblies.
 
static IEnumerable< Assembly > GetAllWeavedAssemblies ()
 Gets all assemblies that have been weaved.
 
static IEnumerable< Type > GetAllWeavedNetworkBehaviourTypes ()
 Gets all types that are assignable from NetworkBehaviour from all weaved assemblies.
 
static IEnumerable< Type > GetAllWeavedSimulationBehaviourTypes ()
 Gets all types that are assignable from SimulationBehaviour from all weaved assemblies.
 
static IEnumerable< Type > GetAllWeaverGeneratedTypes ()
 Gets all types that have the WeaverGeneratedAttribute from all weaved assemblies.
 
static T GetCustomAttributeOrThrow< T > (this MemberInfo member, bool inherit)
 Retrieves a custom attribute of type T from the provided member.
 
static NetworkBehaviourWeavedAttribute GetWeavedAttributeOrThrow (Type type)
 Gets the NetworkBehaviourWeavedAttribute for the specified type. Throws an InvalidOperationException if the type has not been weaved.
 

Detailed Description

Provides utility methods for reflection.

Member Function Documentation

◆ GetAllNetworkBehaviourTypes()

static IEnumerable< Type > GetAllNetworkBehaviourTypes ( )
static

Gets all types that are assignable from NetworkBehaviour from all assemblies.

Returns
An IEnumerable of all types that are assignable from NetworkBehaviour.

◆ GetAllSimulationBehaviourTypes()

static IEnumerable< Type > GetAllSimulationBehaviourTypes ( )
static

Gets all types that are assignable from SimulationBehaviour from all assemblies.

Returns
An IEnumerable of all types that are assignable from SimulationBehaviour.

◆ GetAllWeavedAssemblies()

static IEnumerable< Assembly > GetAllWeavedAssemblies ( )
static

Gets all assemblies that have been weaved.

Returns
An IEnumerable of all weaved assemblies.

◆ GetAllWeavedNetworkBehaviourTypes()

static IEnumerable< Type > GetAllWeavedNetworkBehaviourTypes ( )
static

Gets all types that are assignable from NetworkBehaviour from all weaved assemblies.

Returns
An IEnumerable of all types that are assignable from NetworkBehaviour in weaved assemblies.

◆ GetAllWeavedSimulationBehaviourTypes()

static IEnumerable< Type > GetAllWeavedSimulationBehaviourTypes ( )
static

Gets all types that are assignable from SimulationBehaviour from all weaved assemblies.

Returns
An IEnumerable of all types that are assignable from SimulationBehaviour in weaved assemblies.

◆ GetAllWeaverGeneratedTypes()

static IEnumerable< Type > GetAllWeaverGeneratedTypes ( )
static

Gets all types that have the WeaverGeneratedAttribute from all weaved assemblies.

Returns
An IEnumerable of all types that have the WeaverGeneratedAttribute in weaved assemblies.

◆ GetCustomAttributeOrThrow< T >()

static T GetCustomAttributeOrThrow< T > ( this MemberInfo  member,
bool  inherit 
)
static

Retrieves a custom attribute of type T from the provided member.

Template Parameters
TThe type of the attribute to retrieve. Must be a subclass of Attribute.
Parameters
memberThe member to retrieve the attribute from.
inheritSpecifies whether to search this member's inheritance chain to find the attributes.
Returns
The custom attribute of type T.
Exceptions
ArgumentOutOfRangeExceptionThrown when the provided member does not have an attribute of type T.
InvalidOperationExceptionThrown when the provided member has more than one attribute of type T.
Type Constraints
T :Attribute 

◆ GetWeavedAttributeOrThrow()

static NetworkBehaviourWeavedAttribute GetWeavedAttributeOrThrow ( Type  type)
static

Gets the NetworkBehaviourWeavedAttribute for the specified type. Throws an InvalidOperationException if the type has not been weaved.

Parameters
typeThe type to get the NetworkBehaviourWeavedAttribute for.
Returns
The NetworkBehaviourWeavedAttribute for the specified type.
Exceptions
InvalidOperationExceptionThrown when the type has not been weaved.