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"

change tint of image on hud

I think I've gotten the HUD pointer correctly using:

 Hud = UGameplayStatics::GetPlayerController(this, 0)->GetHUD();

Now, I'm wanting to change the color of the crosshairs I made using 4 white images. I want to change the tint appearance property to green but I don't know how to get the Image on the HUD.

I've looked here:


But I didn't see anything about images. What step am I missing?


Product Version: UE 4.22
more ▼

asked May 15 '19 at 02:04 PM in C++ Programming

avatar image

5 1 1 1

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

1 answer: sort voted first

You can use AHUD::DrawLine() to draw crosshair with 2 lines by providing function with Start and end points and color. Same thing you can archive using AHUD::DrawRect() which also takes color as input along other variables. With this one you can make your crosshair thicker or thinner if you like. And there is also AHUD::DrawTexture() which also takes color to tint the image among other parameters. For this one you would need to provide reference to texture you want to draw. Feel free to explore and experiment. There are usually more ways to accomplish single thing in game development. Use the one that works best for you. All of above functions take color as parameter so you would need to provide them with color you want.

If you want more complete example from production you can look on Helium Rain Github repository. Whole game is made using Slate and I personally using it as great learning resource!

more ▼

answered May 15 '19 at 07:49 PM

avatar image

Vertex Soup
288 4 22 16

avatar image spinland May 16 '19 at 01:45 PM

Yeah I had thought to try those but I was thinking it would be more profitable to learn how to get the items/widgets/images/text on my HUD blueprint since the later on there will be more things on it and I'd rather design the hud in blueprint than c++ since blueprint seems to be better for visual things. For example I am going to have two progress bar like items to keep score and another variable. I'm going to have to be able to change those from c++.

Is there not an easy way to reference the items placed on the hud canvas in unreal? If not, I may have to do the whole hud in blueprint instead of some in c++.

avatar image Vertex Soup May 16 '19 at 04:14 PM

I updated answer with example real-world game project you can learn from.

(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