Announcement

Collapse
No announcement yet.

Cast To GameHUD

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Great! Thx everyone for the helpful input!

    Leave a comment:


  • replied
    Originally posted by Istvan View Post
    As a total newb getting into this, and trying to follow the tutorial, this is a huge pain in the butt. I wish the tutorial was updated.
    Updated the tutorial, looking back at this... I'm not sure why I was including the Cast To GameHUDs (shouldn't have had to do that)... this was done awhile ago and I've had some more time with UMG (Nick's Tip I've included in it as well).

    Not sure when the updates will be published, but I've made the changes and will link it when it makes it to the next change list/version update.

    -W

    Leave a comment:


  • replied
    Originally posted by Istvan View Post
    Is there any chance the tutorial might be updated for those who want to use the full step-by-step?
    Did you try the updated step-by-step version I linked above? https://db.tt/HXHGPFmT

    I'm not sure if anyone else has tried it yet so I would appreciate any feedback you have. Cheers.

    Leave a comment:


  • replied
    Is there any chance the tutorial might be updated for those who want to use the full step-by-step?

    Leave a comment:


  • replied
    Originally posted by ayretek View Post
    ps: this was also a huge pain to me as well, so you are not alone! any further issues can sometimes be resolved simply by saving or compiling and even at times, restarting editor. again good luck & happy programming.
    As a total newb getting into this, and trying to follow the tutorial, this is a huge pain in the butt. I wish the tutorial was updated.

    Leave a comment:


  • replied
    wow, these things get out of hand so fast. get this:

    (step 7 in #4) Just leave the 'Cast to "GameHUD"' out! (or whatever you named it) but you still need to set it as in step 4 in #4 Displaying Ammo, Health, Energy part of the tutorial. So you can use it later, just follow the steps in tutorial. Also, if you 'Read' step 8, clearly states to compile and save.

    Same goes for #5 Experience Bar and Hot Bar Button, step 4 of Generating Experience and Finishing Up -> Leave It Out!

    You can pull straight off of the blue pin of your HUDWidget (whatever you named it) to access the rest.

    Don't make these things no more complicated than they already are, I see this so much when looking at others work. Saw one that was almost a full page BP that was easily done in a few steps. And trust me I'm new and no wizard with this.

    good luck to you all, this should help a lot.

    ps: this was also a huge pain to me as well, so you are not alone! any further issues can sometimes be resolved simply by saving or compiling and even at times, restarting editor. again good luck & happy programming.
    Last edited by ayretek; 11-12-2014, 06:02 PM.

    Leave a comment:


  • replied
    Guys, after reading this and playing with this thing, I guess I found out what the problem is:

    When you promote to variable the output of the function "Create GameHUD_C Widget" You are creating a variable that is already a GameHUD var... that's why when you try to access it from MyCharacter, you already get an object GameHUD... that's why unreal engine doesn't understand you when you try to cast it into a GameHUD object!
    Click image for larger version

Name:	Schermata 2014-11-12 alle 16.44.49.png
Views:	1
Size:	166.4 KB
ID:	1060947
    BUT if you create a generic variable that will contain a generic UserWidget Object (which is the parent class of our GameHUD blueprint) voilĂ ... it will be able to contain any UserWidget blueprint, including our GameHUD blueprint! which we do when calling "Create GameHUD_C Widget".
    Click image for larger version

Name:	Schermata 2014-11-12 alle 16.45.01.png
Views:	1
Size:	225.9 KB
ID:	1060946

    Leave a comment:


  • replied
    Like Madfish, I want to thank ALL of you for this very helpful thread. I was really pulling my teeth out on this tutorial. Reading it through and figuring it out helped me fix several other blueprint problems I was having because of version issues. A special thanks to Nick for the Pro Tip, it is something I never thought about using before but now I can't stop.

    Finally to Madfish, thank you very much for putting all the comments together to the fix this tutorial. What a great pay forward!

    Leave a comment:


  • replied
    Sushichris, Eggbird and other contributors,
    Thanks for this thread, I ran into the same problems when I tried the UMG Quick Start Guide yesterday. Thanks to the info in this thread I eventually got the tutorial example working.

    While I can't pay you back (as your problems were resolved) I thought I could perhaps pay it forward to others that may hit this same obstacle so I have had a go at re-writing the problem sections of the Quick Start Guide. The Dropbox link below contains a pdf which includes all six sections of the Quick Start Guide and combines the solutions suggested in this thread. Where the instructions have been changed I have outlined the old instructions in grey, and the new instructions are outlined in red.

    The new guide suggestions implement 3 basic changes:
    1. Change H_AmmoMax to "Expose on Spawn" (thanks Nick Darnell for the pro-tip)
    2. Remove the need for the variable GameHUDWidget by using Cast To MyCharacter instead.
    3. Add a new public variable P_Experience in the MyCharacter blueprint which has scope to the other two blueprints (GameHUD and MyProjectile).

    I'm sure there are better ways to do it than I have done, but it works (for now ) and hopefully someone else having the same issues will find this thread and get some value out of it.

    https://db.tt/HXHGPFmT

    At least it was a good exercise in learning about blueprint communication (maybe that was their intention all along (Illuminati confirmed ))

    Leave a comment:


  • replied
    I meanwhile 'solved' it with a 'cast to MyCharacter' node in the 'MyProjectile' Blueprint (casting the calculation to a float variable in the MyCharacter blueprint). I than fetched that same float variable (again with a 'Cast to MyCharacter' node) in the 'GameHUD' blueprint and used that as the percentage of the experience bar.

    This basically does the same as what is intended in the quickstart guide.

    Here you can read a bit more about when and how to use what kind of communication form between blueprints:

    https://docs.unrealengine.com/latest...age/index.html

    But it looks like either the documentation needs to be updated, or the things described regarding casting aren't yet implemented in unreal or something...

    Leave a comment:


  • replied
    I am stuck also. I will keep playing around with the UMG and hopefully soon the documentation will finally be updated and the tutorials will be in sync. I need a better understanding of how blueprints work... It's less foggy to me, but not clear enough for me to efficiently use it. Back to the beginner tutorials

    Leave a comment:


  • replied
    Originally posted by NickDarnell View Post
    Pro-Tip: Instead of calling Set HAmmoMax after constructing the widget, you can set the variable as "Expose On Spawn", and it will show up as a Pin on Create Widget nodes that construct that type.
    Even better, thx a lot!

    I'm actually also running into a similiar problem in the next part of the quick start guide 5. Experience Bar and Hotbar Button. Its a little different, but perhaps the reason is kind of the same?

    It's about adjusting the 'MyProjectile' Blueprint so that when you hit a box you gain experience. I'm am not able to do what is stated in part 3. Off the As My Character C pin, Get GameHUDWidget (our Widget Blueprint) and Cast To GameHUD.

    Again I am not able to 'Cast to GameHUD'. I tried doing it differently with a create widget node with the GameHUD as class (like the previous solution). Here is a screenshot of what I got:

    Click image for larger version

Name:	2014-10-30 14_24_18-MyProjectile_.png
Views:	1
Size:	112.8 KB
ID:	1060395

    The calculation is made, as I can see because of the print string I added, but the results aren't written (or cast?) to the actual GameHUD. Can I cast directly to the gamehud or do I have to first use a 'cast to mycharacter' node? I tried several options but none seem to work.
    Last edited by Eggbird; 10-30-2014, 09:28 AM. Reason: screenshot added

    Leave a comment:


  • replied
    Pro-Tip: Instead of calling Set HAmmoMax after constructing the widget, you can set the variable as "Expose On Spawn", and it will show up as a Pin on Create Widget nodes that construct that type.

    Leave a comment:


  • replied
    Originally posted by DarkHorror View Post
    What I am saying is there is no reason to cast to that, it's already what you are casting it to. Those directions are just incorrect.

    What you want to do is super simple, take those directions to no. 3. Then after 3 drag off the return value of the createwidget node and drag it to the Set MaxAmmo, then add the createdwidget to viewport. You will not need to cast at all here.
    Thx a lot, this is indeed a lot easier.

    Quite obvious actually... problem is when I'm following a tutorial I forget to think for myself That usually comes afterwards when things are working and I can analyse and fully understand it

    Perhaps for others, this is what I got:

    Click image for larger version

Name:	2014-10-28 22_48_41-MyCharacter.png
Views:	1
Size:	94.7 KB
ID:	1060334

    Leave a comment:


  • replied
    I know this is already mentioned but yeah - casting to in the old docs is old hat. It was part of the (essentially) beta release and changed. The docs are getting worked on from what I've heard.

    I have had to redo nodes a few times though btw, it seems to mainly come from me copying and pasting stuff but could be other things too..

    Leave a comment:

Working...
X