x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do i make a custom cursor to be on top of a UMG Widget?

Hello, i created a custom cursor using the Canvas on my GameHUD. I also create an UMG Widget, but to my surprise the Canvas layer is behind the UMG layer. How do i set that custom cursor to be on top?

Product Version: Not Selected
Tags:
more ▼

asked Sep 30 '14 at 11:59 PM in Using UE4

avatar image

xlar8or
6k 163 129 305

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Another way to create cursor, you can :

1.Create a new widget called Mouse Cursor(or anything else).

2.Put your cursor image into Root Canvas, define a size to it

3.Align image to center of canvas (Anchor ->Center, Pivot -> X=0.5 Y=0.5, Position= 0,0 )

4.Call "Create Widget" node & "Add To Viewport" node once in other BP such as HUD BP or Character BP when game start.

5.Don't forget to set ZOrder in AddToViewport node to a large number that always greater than your amount of widgets exist at same time.

6.Save this widget reference to a variable.

7.Set widget's position to mouse position use "Set Position In Viewport" in Event Tick.

Advantages:

You don't need to create cursor image in every widget. (Less work and easy to modify)

You can use HUD BP to set cursor position, apply HUD class to Game Mode so that you could assign custom cursor to specific level.

more ▼

answered Oct 05 '15 at 03:49 PM

avatar image

Smomo
179 13 17 33

avatar image mbelarouci Jan 20 '16 at 05:47 AM

Thanks for this. For anyone wondering, this is how it looks:

blueprint - used the top left as the anchor.

avatar image braindigitalis Feb 04 '18 at 11:37 PM

Thanks, this works great but of course there is quite a bit of lag.

For my game this isn't that much of a show-stopper so this solution works great as-is.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You have 2 options:

  1. Use Slate (or UMG) and its SCanvas layout to draw and position your custom cursor.

  2. Use source build solution for custom hardware cursor. I shared one on forum: https://forums.unrealengine.com/showthread.php?46605-TUTORIAL-C-Advanced-Custom-hardware-cursor-loading-for-Win-and-Mac

more ▼

answered Oct 01 '14 at 02:14 PM

avatar image

TimGS
626 20 23 239

avatar image xlar8or Oct 06 '14 at 02:03 PM

Thank you, i will try it out ! :)

avatar image yurembo Dec 06 '14 at 08:02 PM

@TimeGS, can you tell about a first option wider?

avatar image TimGS Dec 07 '14 at 10:30 PM

SCanvas lets you to draw any widget at defined coordinate on the screen. So you create cursor image inside SCanvas slot (do that after you create all widgets so cursor will be on top) and every frame do following steps:

  1. Check for mouse cursor coordinates and if they change do next step.

  2. Change SCanvas cursor image slot's Position attribute to new mouse coordinate

Also make sure to recreate cursor slot every time you create new widget so new widget will not overlap your cursor

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question