Helper Methods
UnrealSharp extends Unreal Engine by providing simplified methods to spawn and manage Actor and ActorComponent objects. Below are the available methods for each class type.
Methods Available for Actor Classes:
Basic Spawn
Spawns an instance of the specified class.
Spawn with Transform
Spawns an instance of the specified class at a specific transform.
Spawn with Collision Handling
Spawns an instance of the specified class with specified collision handling, instigator, and owner.
Methods Available for ActorComponent Classes:
Retrieve Component
Retrieves the StaticMeshComponent of the specified actor.
Construct New Components
Constructs new mesh components with specified owner, attachment settings, and transform.
Enabling Code Generation
To use the code generation for your custom classes (it’s already enabled for engine classes), update your project file (csproj) to include the source generator. Add the following lines to your csproj file:
Class Requirements
For the generated methods to be applicable, your classes must be declared as partial:
Last updated