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"

Difference ways to get HUD reference

Hi people,

I'm rather new to UE and what I'm trying to do is fire up a custom event I created in a newly created HUD class from a different blueprint. I managed to do that (by the method below in the image) but I didn't understand why one of the ways was wrong and wouldn't let me access the event.

alt text

Can somebody clarify it for me why the first method, the one with the purple node (which I didn't get, what type is it?C++ class?) wouldn't work?
Thanks!

Product Version: UE 4.21
Tags:
more ▼

asked Jun 02 '19 at 05:36 AM in Blueprint Scripting

avatar image

dakrn1k3
8 1 2 4

avatar image Nebula Games Inc Jun 02 '19 at 04:26 PM

To add to Shadowriver's explanation, the first one you are accessing a "class", this only allows you to see properties of the class as a whole (variables for example) but it doesn't allow you to effect change or call functions because you don't have a specific class "object" to act upon. The second setup works because you are getting a specific instance of the VN_HUD class which has the ability to call functions and things in game. If you are new and want to better understand casting/references check out video #1 and 25 in the link below. I go over both in a beginner friendly tutorial in more detail.

https://www.youtube.com/playlist?list=PLyu-W38DvZhqByAoeva1jewB5s78zQHIy

avatar image dakrn1k3 Jun 03 '19 at 03:32 PM

Thank you for the youtube reference, nice playlist you got there!

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

1 answer: sort voted first

That a class reference, as you can see it purple which indicates that, you can not access object from it, you can only reference class, to spawn or search for object and other things.

HUD object is created and stored as each player need individual instance of it and you can access it via "Get HUD" node.

Also one note, UMG technically don't require HUD object, HUD class is primerly for old canvas HUD system (which is still useful as it allows to draw things more freely), so if you want to you can create widget in PlayerController and if you make single player game you can also place it in GameMode.

more ▼

answered Jun 02 '19 at 06:53 AM

avatar image

Shadowriver
37.2k 936 172 1116

avatar image dakrn1k3 Jun 02 '19 at 09:32 AM

Oh cool, thanks for the reply. Now it is much more clear to me.
About your note, but isn't it considered generally a "better" game design if you separate each system to its parts and make it more simple to understand and access later on when your project gets bigger and bigger?

(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