Class PluginExtensionAttribute
- Namespace
- KeenEyes
- Assembly
- KeenEyes.Abstractions.dll
Marks a class as a plugin extension that should generate a typed accessor property on World.
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
public sealed class PluginExtensionAttribute : Attribute
- Inheritance
-
PluginExtensionAttribute
- Inherited Members
Examples
// Mark the extension class
[PluginExtension("Physics")]
public sealed class PhysicsWorld
{
public RaycastHit? Raycast(Vector3 origin, Vector3 direction) { ... }
}
// Usage becomes:
var hit = world.Physics.Raycast(origin, direction);
Remarks
When applied to a class, the source generator will create a C# 13 extension member that provides direct property access instead of using World.GetExtension.
The generated extension allows code like world.Physics instead of
world.GetExtension<PhysicsWorld>().
Constructors
PluginExtensionAttribute(string)
Marks a class as a plugin extension that should generate a typed accessor property on World.
public PluginExtensionAttribute(string propertyName)
Parameters
propertyNamestringThe name of the property to generate on World.
Examples
// Mark the extension class
[PluginExtension("Physics")]
public sealed class PhysicsWorld
{
public RaycastHit? Raycast(Vector3 origin, Vector3 direction) { ... }
}
// Usage becomes:
var hit = world.Physics.Raycast(origin, direction);
Remarks
When applied to a class, the source generator will create a C# 13 extension member that provides direct property access instead of using World.GetExtension.
The generated extension allows code like world.Physics instead of
world.GetExtension<PhysicsWorld>().
Properties
Nullable
Gets or sets whether the extension property is nullable. When true, the property returns null if the extension is not registered. When false (default), accessing the property throws if the extension is not registered.
public bool Nullable { get; set; }
Property Value
PropertyName
Gets the property name to generate on World.
public string PropertyName { get; }