Download

mouse cursor disappear

I am using FPS template to one minor fps project, works in standalone but when packaged mouse cursor disappear. Where to find problem. Here is start level blueprint and firstperson gamemode blueprints b733e76b0200d8247a6ca1a12bd50f3178f53951.jpeg

Hello tero83,

I maybe wrong, but this issue is pretty similar to what I have experienced few months ago.

One important thing to keep in mind when using UE4, is, you cannot assume the timing and priority of “event begin play”!

In your blueprint, you get player controller in your level begin play, but the player controller may not be initiated at that moment! (hence “Show mouse cursor will fail!”)

You may ask, if this is the case, how come your blueprints work in editor and stand alone build?

That is because the priority of initializing is different PIE / standalone vs Packaged build!!

How to solve this issue? How to guarantee when you’re calling controller’s function in other class’s initialization function the controller exist?

Here is my generic solution:

  1. Make a bluepirnt class inherit GameInstance. (Ex: BP_MyGameInstance)
  2. In BP_MyGameInstance class, make a function call “Set_Controller()”
  3. In BP_MyGameInstance class, make a function call “Set_Level()”
  4. In your controller class, at event begin play, get gameinstance and cast to BP_MyGameInstance, then call Set_Controller()
  5. In your level blueprint, at event begin play, get gameinstance and cast to BP_MyGameInstance, then call Set_Level()

*note: get gameinstance will always return a valid instance, unlike controller, hud, playercharacter…etc. That is why this method works.
(don’t forget to assign BP_MyGameInstance in your project setting)

  1. In Set_Controller() cache the controller and check if level is valid, if both are valid, then do “show mouse cursor”
  2. In Set_Level() cache the level and check if controller is valid, if both are valid, then do “show mouse cursor”

Or, if you found this solution too much work for a simple task, you can simply call “show mouse cursor” in your controller’s event begin play.

*note: If I remember correctly, in UE4.14 there is a bug where player character class will reset “show mouse cursor”, so I call “show mouse cursor” at my character’s event begin play instead.

Again, I might be wrong, and the problem you’re facing maybe attributed to other issues, hope this help.

This also appear only in packaged game and appear when one time clicked