Make UI With C++: How to use Slate in Unreal Engine

Sdílet
Vložit
  • čas přidán 21. 08. 2024

Komentáře • 95

  • @RandomGuyyy
    @RandomGuyyy Před 4 lety +14

    This helps me understand the UI code in the ShooterGame example project as that's all Slate based. Thank you!

  • @xeru9865
    @xeru9865 Před 4 lety +10

    Right at the beginning when you create the widget c++ class, you can actually just scroll to the bottom of that menu and there are default constructor options for both slate widget and slate widget style that do all the default includes automatically

  • @TechNova45
    @TechNova45 Před 4 lety +6

    Very cool. What I usually do is create a C++ user widget class, then a widget blueprint and change its parent to the user widget C++ class, with that I have the flexibility of widget blueprint for adding buttons etc easily and I can use C++ for anything else like drag enter, mouse enter or anything else really.

  • @steffennilsen2132
    @steffennilsen2132 Před 4 lety +10

    If you come from a webdev environment, the composition syntax of slate is quite easy to digest

  • @faei1897
    @faei1897 Před 2 měsíci +1

    For anyone else curious about what adding const before override does - it just goes "hey, we won't change anything about this object!". I had a copy of C++ Programming 4th. Edn. on hand and went looking. Page 307 on §12.1.2 explains the parts of a function declaration.

  • @daigriff1989
    @daigriff1989 Před 4 lety +4

    This has helped me a great deal!
    Slate code absolutely terrified me but now I understand it, and it's weird syntax a whole lot better.
    Thanks for the great tutorial

  • @Guraw
    @Guraw Před 2 lety +2

    Still 100% accurate and working in UE5 early access. Thank you for a great tutorial!

  • @karthikeyatsvr3838
    @karthikeyatsvr3838 Před 7 měsíci +1

    Best video ever. Very helpful.
    Also could you please do a video on how to make the buttons UI design like icons(fps, replay, file explorer icons with functionalities) and Also hover and Click animations

  • @Teturarsyra
    @Teturarsyra Před 3 lety +1

    If you wonder what's the 'class' in 'TWeakObjectPtr OwnerHUD;' it is just a concise way to use forward declaration, it's equivalent to:
    class AMainHUD;
    TWeakObjectPtr OwnerHUD;

  • @philboltt
    @philboltt Před 4 lety +2

    Thanks for this! It's a huge help in getting over that initial Slate WTF moment :) More Slate tutorials pls!

  • @IsaacCode95
    @IsaacCode95 Před rokem +1

    thank you! your c++ are the best i've seen, would you consider making a c++ tutorial that is relevant to UE5 ?

  • @PBOZAI
    @PBOZAI Před 3 lety +5

    An issue with code at 17:21
    This might be a change to more current versions of Unreal, but GEngine might be shared between multiple PIE windows. This often leads GEngine->GameViewPort to point to the incorrect viewport. This can be avoided by using something like
    ULocalPlayer* LocPlayer = Cast(PlayerOwner->Player);
    if (LocPlayer && LocPlayer->ViewportClient){
    auto* VC = LocPlayer->ViewportClient;
    VC->AddViewportWidgetContent(SAssignNew(MenuWidgetContainer, SWeakWidget).PossiblyNullContent(MenuWidget.ToSharedRef()));
    and similar for VC->RemoveViewportWidgetContent
    The LocPlayer client is guaranteed to be the correct client for each AHUD instance in this edge case.

    • @PBOZAI
      @PBOZAI Před 3 lety +2

      As of writing this only fixes a bug that occurs when multiplayer is being tested in editor. Thought, the documentation indicates that Unreal might further use this type of behavior in the future.

  • @frankhilpert4893
    @frankhilpert4893 Před 4 lety +1

    thank you! this is exactly what i was looking for. you have the ways of a great teacher about you. great to listen to.

  • @gamemakerdude
    @gamemakerdude Před 4 lety +2

    Outstanding tutorial as always! I have a request, please. Would you please consider making a tutorial on how to move pawns in a circle?

  • @karthikeyatsvr3838
    @karthikeyatsvr3838 Před 7 měsíci +1

    Very Helpful🎉

  • @cDogRage
    @cDogRage Před 5 měsíci

    Thank you so much for this.

  • @noahsteam8214
    @noahsteam8214 Před 3 lety

    Thank you for putting this together. Very helpful.

  • @darkferiousity
    @darkferiousity Před 2 lety

    This kind of reminds me using React Three Fiber which is pretty cool. I was happy I found your vids I just like doing everything in c++.

  • @robinj6997
    @robinj6997 Před rokem

    Such a great tutorial! Thank you

  • @irajmh
    @irajmh Před 4 lety +3

    Can we have a tutorial on how to add a SvirtualJoystick?

  • @StefanJann
    @StefanJann Před měsícem

    Thank you

  • @DevGods
    @DevGods Před 4 lety

    I bought the course before it was finished but don’t have access to the rest of the lessons! Been trying to get in touch with Reuben but he’s been absent really want to finish this course for learning purposes

  • @artoriasdenostradamus3628

    Could you do a tutorial to do for example an dynamic health bar and enemy kill counter with this method of slate ,please ?

  • @demidrek-heyward
    @demidrek-heyward Před 3 lety

    thanks Reuben!

  • @RedFlowering
    @RedFlowering Před 3 lety

    Thx! You are My Super Great Teacher!!

  • @Cronofear
    @Cronofear Před rokem

    The problem with slate are the slow iteration times/slow compilation. The system itself is as simple as json.

  • @volkadrum
    @volkadrum Před 4 lety +2

    Thanks so much for this great tutorial! I would love to learn more about using slate to store player input (e.g. player name) from a editable text box. Con someone help?

  • @leonardo6631
    @leonardo6631 Před rokem

    Great video!!

  • @tophinski
    @tophinski Před 4 lety

    I've been considering purchasing your Survival game course and I"m wondering which version you use. Thanks, great content as always, Reuben.

    • @reubs
      @reubs  Před 4 lety +2

      We use 4.23 in the course.

    • @tophinski
      @tophinski Před 4 lety +1

      @@reubs Perfect, thanks for the reply!

    • @tophinski
      @tophinski Před 4 lety

      @@reubs One more question, does the survival course use a projectile system or ray casting for the bullets?

  • @mr-lks
    @mr-lks Před 4 lety +1

    what is the differences between making ui on c++ or blueprint? Is there any efficiency

  • @Teturarsyra
    @Teturarsyra Před 3 lety +3

    No need to over-complexify the code, here is a straightforward way to add your widget to the viewport with Slate:
    void AMyHUD::BeginPlay() {
    if (GEngine && GEngine->GameViewport) {
    mainMenuWidget = SNew(SMainMenuWidget);
    mainMenuWidget->owning_hud = this;
    GEngine->GameViewport->AddViewportWidgetContent(mainMenuWidget.ToSharedRef());
    }
    }

    • @DaBaSoftware
      @DaBaSoftware Před 2 lety

      Tested and works great in UE5 Preview :)

  • @mourirsilfaut6769
    @mourirsilfaut6769 Před 2 lety

    It looks weird when I change background color.

  • @vegitoblue2187
    @vegitoblue2187 Před 3 lety

    So in theory this slate widget could be made from anywhere not just HUD right?

  • @Dan-zw2sc
    @Dan-zw2sc Před 3 lety

    This seems really useful for making custom widgets. But is there an advantage over BP for doing the layout of the widgets in the HUD in C++?

  • @andikarizkyoktavian8581

    my button is greyed out and when mouse hovered above it, there is no sign of my button being hovered. and i can't click the button too. is there something wrong in my code or this is bug in UE5?

  • @matheus-kirchesch
    @matheus-kirchesch Před 3 lety

    Are you planing on a more in depth slate tutorial? would be nice

    • @matheus-kirchesch
      @matheus-kirchesch Před 3 lety

      if not, do you have a doc or something with alot of information about it? maybe the code of a Custom Editor UI of yours

  • @ayoubtouaty8255
    @ayoubtouaty8255 Před 2 lety +1

    Can anyone tell me how to create a custom button position editor like mobile games have ❤️🙏

  • @RockWarCry
    @RockWarCry Před 2 lety +1

    It looks a lot like Flutter`s and Swift UI`s way of composing UIs

  • @halfbakedproductions7887
    @halfbakedproductions7887 Před 2 měsíci

    HUD Class is legacy and deprecated in UE5.

  • @VampNeo
    @VampNeo Před 3 lety

    Wow, awesome.
    I am actually following your course on Udemy also.
    Any chance I can learn more , I mean I want to make slate widgets customizable, like you provide a edit layout window and then the user can edit different widget position and sizes. Actually I am trying fps mobile game , and its pain to find any tutorials . Most of the tuts are also about umg and not about the slate widgets. But I came to know that for touch Interfaces slates are the way to go, but can't find good tutorial on how to make them customizable like drag and drop umg

  • @wisper8628
    @wisper8628 Před 3 lety

    very nice

  • @goken-san9224
    @goken-san9224 Před 3 lety

    My character and the camera isn't moving after adding the slate code. What can I do to fix this?

  • @NicoleSummer8
    @NicoleSummer8 Před rokem

    Awesome 🎉

  • @perregrinne2500
    @perregrinne2500 Před 4 lety

    At 3:55, I think you could just add "Slate" and "SlateCore" into the addRange line above instead of making a second line, but that's a pretty insignificant nitpick. Still a really useful tutorial. Also, just started getting back into Cryengine last week. Any tutorials there would be absolutely welcome!

  • @reubs
    @reubs  Před 4 lety +13

    1st

  • @jasoncrosby8523
    @jasoncrosby8523 Před rokem

    Coming from a mobile developer background this looks very similar to Android Compose and iOS Swift UI.

  • @artoriasdenostradamus3628

    The Survival game course is developed in pure c++ or both c++ and blueprints?

  • @DanielOraraVA
    @DanielOraraVA Před 4 lety

    howcome the module is there in the files, but not automatically implemented or included?

  • @redjohn4886
    @redjohn4886 Před 2 lety +1

    Where is the MenuGameMode class coming from ?

    • @user-od4wm5cj6g
      @user-od4wm5cj6g Před rokem

      i think the reason is your project is a blank project.

  • @Aethrax8
    @Aethrax8 Před 2 měsíci

    Do you know how can I add textures as a png (like in UMG in unreal) to images or buttons in slate ? I will be very greatfull if you know and answer. Thanks already.

  • @JoshDucote
    @JoshDucote Před 3 lety

    how would i go about making options menu to pop up when i click it?

  • @biedagejming
    @biedagejming Před 3 lety

    Will this Survival game course be some day on Udemy ??

  • @Atl3m
    @Atl3m Před rokem

    can this be done in user widget also . not slate ?

  • @quazitarik
    @quazitarik Před 2 lety

    how do I load image from local drive instead of changing color to black

  • @wayancientmoon1142
    @wayancientmoon1142 Před 3 lety

    Thanks a lot for this nice tut! I thought it's just a half hour course, acutally took me one day to understant it. XD
    Just got one question: why my VA cannot use "Add Include" ? it is grey and I cannot click it.

  • @lennysmileyface
    @lennysmileyface Před 4 lety

    Can you only make slate widgets that inherit from classes like SCompoundWidget?

  • @katietooher8472
    @katietooher8472 Před rokem

    Hello, does anyone know if this is possible to create with an SWindow instead of using a HUD class?

  • @paulhax
    @paulhax Před 4 lety +1

    Looks like good content. A suggestion: triple or more the editor text size. I can't read the code on my laptop screen.

  • @hydrogen5087
    @hydrogen5087 Před 2 lety

    **Help!**
    When I compile at timestamp 13:08, I get:
    Error C2660 'SWidget::Construct': function does not take 1 arguments
    How should I proceed? Kindly help me, please.

  • @Muhammad_Abdullah_Sultan

    Good

  • @rukiandtheenok437
    @rukiandtheenok437 Před 3 lety +1

    Hi I am new at dev in UE. I have a problem in my MenuHUD.cpp in this row:
    GEngine->GameViewport->AddViewportWidgetContent(SAssignNew(MenuWidgetContainer, SWeakWidget).PossiblyNullContent(MenuWidget.ToSharedRef()));
    There is an Error (E0312) on MenuWidget.ToShareRef ... I don't find any differences to your code :-(

    • @ElodinMaster
      @ElodinMaster Před 3 lety

      I also have an error with that line. Did you find the solution?

    • @rukiandtheenok437
      @rukiandtheenok437 Před 3 lety

      @@ElodinMaster Hi no sry. A friend of me wrote the script on his project. And I copied that stuff. I don't now whats wrong with that line

    • @ElodinMaster
      @ElodinMaster Před 3 lety +1

      ​@@rukiandtheenok437 Found out the problem in my case. I forgot to write the public keyword before SCompoundWidget when doing the inheritance of SMainMenuWidget

    • @maxedwardsantos
      @maxedwardsantos Před 2 lety

      For those that have this problem in the future, make sure you are subclassing SCompoundWidget in your SMainMenuWidget class

  • @user-tb3tg3yu8o
    @user-tb3tg3yu8o Před 3 lety

    how to use set a image for simage

  • @arkanzock4082
    @arkanzock4082 Před 3 lety

    Slate or UMG? Whats bettrer?

  • @SouravUE
    @SouravUE Před 4 lety

    Hi, I wanna learn game development i really like unreal and to start in it but every one's suggesting to learn unity.
    What's your opinion as a beginner should i learn unreal ?? and how much time it would take to learn C++ for Unreal.

    • @kryph
      @kryph Před 4 lety +1

      Can I tell you my opinion on it? I have worked in unity and unreal. Unity is a little bit easier to start with, but as you advance it gets to be the same level of difficulty as unreal. C++ and c# are not that different. What kind of game are you making? Unreal is great at making games look graphically amazing without much effort. Unity is best for mobile games. Unreal is not great at 2D, but It’s amazing for 3D. Unreal has blueprints which are an alternative to c++.

    • @SouravUE
      @SouravUE Před 4 lety

      @@kryph Thanks for your insight. Interested in 3d games mostly small rpg like, some ar/vr and later may be something big and awesome. And how much time does c++ takes to learn?

    • @kryph
      @kryph Před 4 lety +1

      Sourav that depends. If you already know a language like c#, you could pick it up in about 1-2 months. Without prior knowledge of a language, takes about 2-3 months to learn the basics. Unreal also has blueprints, so you could start with that.

    • @SouravUE
      @SouravUE Před 4 lety

      @@kryph Thanks a lot for ur time. 🙂

  • @andrew6855
    @andrew6855 Před 4 lety

    I don't really think there is a good reason to use slate over UMG. You mentioned two reasons why you would do so: Performance and access to hidden features. As for performance, as time goes on Epic games will optimise the back-end of UMG more and more so that the performance difference won't be big enough to justify giving up ease of design. As for the hidden features, I was completely unaware of any hidden features or features only accessible through slate. Unfortunately I didn't see you mention any of these "hidden features" in the video since it seems to be catered to absolute beginners.
    Thanks for the great free tutorials though! It's people like you that strengthen the game dev community! :)

    • @reubs
      @reubs  Před 4 lety +1

      Thanks! An example would be the color picker widget, which isn't available through a widget blueprint. You can write very basic editor extensions with Blueprint, but most more involved extensions will require some C++.

    • @Teturarsyra
      @Teturarsyra Před 3 lety

      For simple UIs and beginners I agree, for complex ones clarity will be on the C++ side not to mention speed will always be slower no matter how much Epic tries. In addition If you use the source version of UE and need for instance to extend the editor and mod things, then c++ slate knowledge is mandatory to understand and modify existing code base.

  • @awoidf
    @awoidf Před rokem

    7:20-7:24 yeah, that's also known as the stockholm-syndrome xD

  • @VladyVeselinov
    @VladyVeselinov Před 4 lety +2

    You can really tell Epic doesn't care about UI, every UI system they have is so clunky...

    • @reubs
      @reubs  Před 4 lety +3

      Try using cryengine! It uses flash lol

    • @VladyVeselinov
      @VladyVeselinov Před 4 lety +1

      @@reubs oh my

    • @ivayloi736
      @ivayloi736 Před 3 lety +1

      Almost all UI frameworks are just terrible. Dear ImGui became very popular because there is really nothing else remotely sane. There are bindings for UE4 btw...

    • @VladyVeselinov
      @VladyVeselinov Před 3 lety

      Y'all I wanna say I didn't mean this in a super negative way, it's totally cool for them to have other priorities

  • @ivayloi736
    @ivayloi736 Před 3 lety

    I see now why they had to come up with UMG in order to expose something... more sane to BP... I get what they were trying to achieve, but breaking the language with macros and non standard style of codding, never ends well...

    • @user-cj7tf1uz6v
      @user-cj7tf1uz6v Před 3 lety

      No, you're wrong, this is actually how normal code is wrote. If you're a designer you use prewritten stuff, but if you need more flexibility and actually making something new you will be doing this.

  • @devintrusdell5733
    @devintrusdell5733 Před 3 lety

    GOD loves y'all and have a Blessed day ✝️⛪🙏🙏🏻🙏🏼🙏🏾🙏🏽🙏🏿👼🏿👼🏾👼🏽👼🏼👼🏻👼😇🥰❤

  • @GiacomoPerin
    @GiacomoPerin Před 4 lety +1

    1st