Change mouse cursor thorugh code

Hey does anyone know how I can change my mouse cursor to and from the crosshair cursor and make the movement a bit more slower in game through code. I tried this but all I get is a crash:


 PC->DefaultMouseCursor = EMouseCursor::Crosshairs;


Any help is much appreciated, thank you :slight_smile:

Look at our code that should be it. Things I would check:

  • is that PC null?
  • our mouse change code has a “if(GetWorld())” guard to ensure it is never fired in constructors (for example they get fired when loading the editor content)

the player controller isn’t null as I did a check before that but now it isn’t crashing it just isn’t changing the cursor at all. Do I have to import a crosshair cursor because I thought unreal had their own? Thank you for the help anyways

Try


PC->CurrentMouseCursor = EMouseCursor::Crosshairs;

That does it, thank you :slight_smile: