AI prompts
base on UnrealSharp is a plugin to Unreal Engine 5, which enables developers to create games using C# (.NET 9) with Hot Reload # UnrealSharp
## Introduction
UnrealSharp is a plugin for Unreal Engine 5 that allows game developers to use C# in their projects with the power of .NET 9. This plugin bridges the gap between C# and UE5, providing a seamless and efficient workflow for those who prefer C# over C++/Blueprints.
[Workflow Showcase](https://www.youtube.com/watch?v=NdbiysPTztA)
## Features
- **C# Integration**: Write your game logic in C#.
- **Seamless Unreal Engine 5 Compatibility**: Fully integrated with the latest UE5 features and API.
- **Hot reload:** Compile and reload code on the fly without having to restart the engine for changes.
- **Automatic Bindings:** Automatically generates C# API based on what is exposed to reflection.
- **.NET Ecosystem:** Use any NuGet package to extend functionality.
## Sample Project
Check out [UnrealSharp-Cropout](https://github.com/UnrealSharp/UnrealSharp-Cropout/tree/main), an ongoing effort to convert [Cropout](https://www.unrealengine.com/en-US/blog/cropout-casual-rts-game-sample-project), originally created in Blueprints, into C# using UnrealSharp.
## Prerequisites
- Unreal Engine 5.3 - 5.5
- .NET 9.0+
## Frequently Asked Questions
[FAQ](https://www.unrealsharp.com/faq)
## Get Started
Visit the website's [Get Started](https://www.unrealsharp.com/getting-started/quickstart) page!
If you want to contribute with documentation, you can contribute to this [repository](https://github.com/UnrealSharp/unrealsharp.github.io)!
## Code Example
```c#
using UnrealSharp;
using UnrealSharp.Attributes;
using UnrealSharp.Engine;
using UnrealSharp.Niagara;
namespace ManagedSharpProject;
public delegate void OnIsPickedUp(bool bIsPickedUp);
[UClass]
// Partial classes are only a requirement if you want UnrealSharp to generate helper methods.
// Such as: MyCustomComponent foundComponent = MyCustomComponent.Get(actorReference);
public partial class AResourceBase : AActor, IInteractable
{
public AResourceBase()
{
SetReplicates(true);
RespawnTime = 500.0f;
}
// The mesh of the resource
[UProperty(DefaultComponent = true, RootComponent = true)]
public UStaticMeshComponent Mesh { get; set; }
// The health component of the resource, if it has one
[UProperty(DefaultComponent = true)]
public UHealthComponent HealthComponent { get; set; }
[UProperty(PropertyFlags.EditDefaultsOnly)]
public int PickUpAmount { get; set; }
// The time it takes for the resource to respawn
[UProperty(PropertyFlags.EditDefaultsOnly | PropertyFlags.BlueprintReadOnly)]
protected float RespawnTime { get; set; }
// Whether the resource has been picked up, is replicated to clients.
[UProperty(PropertyFlags.BlueprintReadOnly, ReplicatedUsing = nameof(OnRep_IsPickedUp))]
protected bool bIsPickedUp { get; set; }
// The effect to play when the resource is picked up
[UProperty(PropertyFlags.EditDefaultsOnly)]
public TSoftObjectPtr<UNiagaraSystem>? PickUpEffect { get; set; }
// The delegate to call when the resource is picked up, broadcasts on clients too.
[UProperty(PropertyFlags.BlueprintAssignable)]
public TMulticastDelegate<OnIsPickedUp> OnIsPickedUp { get; set; }
protected override void BeginPlay()
{
HealthComponent.OnDeath += OnDeath;
base.BeginPlay();
}
[UFunction]
protected virtual void OnDeath(APlayer player) {}
// Interface method implementation
public void OnInteract(APlayer player)
{
GatherResource(player);
}
[UFunction(FunctionFlags.BlueprintCallable)]
protected void GatherResource(APlayer player)
{
if (bIsPickedUp)
{
return;
}
if (!player.Inventory.AddItem(this, PickUpAmount))
{
return;
}
// Get the ExperienceComponent from the PlayerState using the generated helper methods.
UExperienceComponent experienceComponent = UExperienceComponent.Get(player.PlayerState);
experienceComponent.AddExperience(PickUpAmount);
// Respawn the resource after a certain amount of time
SetTimer(OnRespawned, RespawnTime, false);
bIsPickedUp = true;
OnRep_IsPickedUp();
}
[UFunction]
public void OnRespawned()
{
bIsPickedUp = false;
OnRep_IsPickedUp();
}
// This is called when the bIsPickedUp property is replicated
[UFunction]
public void OnRep_IsPickedUp()
{
if (PickUpEffect is not null)
{
UNiagaraFunctionLibrary.SpawnSystemAtLocation(this, PickUpEffect, GetActorLocation(), GetActorRotation());
}
OnIsPickedUpChanged(bIsPickedUp);
OnIsPickedUp.Invoke(bIsPickedUp);
}
// This can be overridden in blueprints
[UFunction(FunctionFlags.BlueprintEvent)]
public void OnIsPickedUpChanged(bool bIsPickedUp)
{
SetActorHiddenInGame(bIsPickedUp);
}
}
```
## Roadmap
Take a look at the roadmap for planned and developed features!
[Roadmap](https://github.com/orgs/UnrealSharp/projects/3)
## Discord Community
Join the discord community to stay up to date with the recent updates and plugin support!
[Discord community](https://discord.gg/HQuJUYFxeV)
## Contributing
I accept pull requests and any contributions you make are **greatly appreciated**.
## License
Distributed under the MIT License. See `LICENSE` for more information.
## Contact
Discord: **olsson.** (Yes, with a dot at the end.)
Or join the [Discord community](https://discord.gg/HQuJUYFxeV).
## Special Thanks
I'd like to give a huge shoutout to [MonoUE](https://mono-ue.github.io/) (Sadly abandoned :( ) for the great resource for integrating C# into Unreal Engine. Some of the systems are modified versions of their integration, and it's been a real time saver.
**Thank you to the MonoUE team!**
", Assign "at most 3 tags" to the expected json: {"id":"7182","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"