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

  Рет қаралды 61,900

reubs

reubs

Күн бұрын

Пікірлер: 95
@xeru98
@xeru98 4 жыл бұрын
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
@steffennilsen2132
@steffennilsen2132 4 жыл бұрын
If you come from a webdev environment, the composition syntax of slate is quite easy to digest
@RandomGuyyy
@RandomGuyyy 4 жыл бұрын
This helps me understand the UI code in the ShooterGame example project as that's all Slate based. Thank you!
@TechNova45
@TechNova45 4 жыл бұрын
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.
@Teturarsyra
@Teturarsyra 3 жыл бұрын
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;
@PBOZAI
@PBOZAI 3 жыл бұрын
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 3 жыл бұрын
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.
@daigriff1989
@daigriff1989 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
@karthikeyatsvr3838
@karthikeyatsvr3838 11 ай бұрын
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
@faei1897
@faei1897 6 ай бұрын
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.
@Guraw
@Guraw 2 жыл бұрын
Still 100% accurate and working in UE5 early access. Thank you for a great tutorial!
@philboltt
@philboltt 4 жыл бұрын
Thanks for this! It's a huge help in getting over that initial Slate WTF moment :) More Slate tutorials pls!
@IsaacCode95
@IsaacCode95 2 жыл бұрын
thank you! your c++ are the best i've seen, would you consider making a c++ tutorial that is relevant to UE5 ?
@andikarizkyoktavian8581
@andikarizkyoktavian8581 2 жыл бұрын
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?
@DevGods
@DevGods 4 жыл бұрын
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
@artoriasdenostradamus3628 4 жыл бұрын
Could you do a tutorial to do for example an dynamic health bar and enemy kill counter with this method of slate ,please ?
@hydrogen5087
@hydrogen5087 3 жыл бұрын
**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.
@gamemakerdude
@gamemakerdude 4 жыл бұрын
Outstanding tutorial as always! I have a request, please. Would you please consider making a tutorial on how to move pawns in a circle?
@frankhilpert4893
@frankhilpert4893 4 жыл бұрын
thank you! this is exactly what i was looking for. you have the ways of a great teacher about you. great to listen to.
@Aethrax8
@Aethrax8 6 ай бұрын
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.
@ayoubtouaty8255
@ayoubtouaty8255 2 жыл бұрын
Can anyone tell me how to create a custom button position editor like mobile games have ❤️🙏
@mr-lks
@mr-lks 4 жыл бұрын
what is the differences between making ui on c++ or blueprint? Is there any efficiency
@redjohn4886
@redjohn4886 3 жыл бұрын
Where is the MenuGameMode class coming from ?
@李佳奇-w9z
@李佳奇-w9z Жыл бұрын
i think the reason is your project is a blank project.
@noahsteam8214
@noahsteam8214 3 жыл бұрын
Thank you for putting this together. Very helpful.
@irajmh
@irajmh 4 жыл бұрын
Can we have a tutorial on how to add a SvirtualJoystick?
@Atl3m
@Atl3m Жыл бұрын
can this be done in user widget also . not slate ?
@robinj6997
@robinj6997 Жыл бұрын
Such a great tutorial! Thank you
@mourirsilfaut6769
@mourirsilfaut6769 2 жыл бұрын
It looks weird when I change background color.
@katietooher8472
@katietooher8472 Жыл бұрын
Hello, does anyone know if this is possible to create with an SWindow instead of using a HUD class?
@rukiandtheenok437
@rukiandtheenok437 4 жыл бұрын
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 4 жыл бұрын
I also have an error with that line. Did you find the solution?
@rukiandtheenok437
@rukiandtheenok437 4 жыл бұрын
@@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 4 жыл бұрын
​@@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 3 жыл бұрын
For those that have this problem in the future, make sure you are subclassing SCompoundWidget in your SMainMenuWidget class
@JoshDucote
@JoshDucote 3 жыл бұрын
how would i go about making options menu to pop up when i click it?
@DanielOraraVA
@DanielOraraVA 4 жыл бұрын
howcome the module is there in the files, but not automatically implemented or included?
@Cronofear
@Cronofear Жыл бұрын
The problem with slate are the slow iteration times/slow compilation. The system itself is as simple as json.
@Dan-zw2sc
@Dan-zw2sc 3 жыл бұрын
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++?
@volkadrum
@volkadrum 4 жыл бұрын
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?
@vegitoblue2187
@vegitoblue2187 3 жыл бұрын
So in theory this slate widget could be made from anywhere not just HUD right?
@biedagejming
@biedagejming 4 жыл бұрын
Will this Survival game course be some day on Udemy ??
@matheus-kirchesch
@matheus-kirchesch 3 жыл бұрын
Are you planing on a more in depth slate tutorial? would be nice
@matheus-kirchesch
@matheus-kirchesch 3 жыл бұрын
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
@artoriasdenostradamus3628
@artoriasdenostradamus3628 4 жыл бұрын
The Survival game course is developed in pure c++ or both c++ and blueprints?
@leonardo6631
@leonardo6631 Жыл бұрын
Great video!!
@lennysmileyface
@lennysmileyface 4 жыл бұрын
Can you only make slate widgets that inherit from classes like SCompoundWidget?
@darkferiousity
@darkferiousity 2 жыл бұрын
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++.
@Teturarsyra
@Teturarsyra 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 2 жыл бұрын
Tested and works great in UE5 Preview :)
@wayancientmoon1142
@wayancientmoon1142 4 жыл бұрын
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.
@perregrinne2500
@perregrinne2500 4 жыл бұрын
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!
@cDogRage
@cDogRage 9 ай бұрын
Thank you so much for this.
@karthikeyatsvr3838
@karthikeyatsvr3838 11 ай бұрын
Very Helpful🎉
@arkanzock4082
@arkanzock4082 3 жыл бұрын
Slate or UMG? Whats bettrer?
@tophinski
@tophinski 4 жыл бұрын
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 4 жыл бұрын
We use 4.23 in the course.
@tophinski
@tophinski 4 жыл бұрын
@@reubs Perfect, thanks for the reply!
@tophinski
@tophinski 4 жыл бұрын
@@reubs One more question, does the survival course use a projectile system or ray casting for the bullets?
@VampNeo
@VampNeo 3 жыл бұрын
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
@RedFlowering
@RedFlowering 3 жыл бұрын
Thx! You are My Super Great Teacher!!
@张某某-m9p
@张某某-m9p 4 жыл бұрын
how to use set a image for simage
@SouravUE
@SouravUE 4 жыл бұрын
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 4 жыл бұрын
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 4 жыл бұрын
@@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 4 жыл бұрын
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 4 жыл бұрын
@@kryph Thanks a lot for ur time. 🙂
@demidrek-heyward
@demidrek-heyward 3 жыл бұрын
thanks Reuben!
@jasoncrosby8523
@jasoncrosby8523 2 жыл бұрын
Coming from a mobile developer background this looks very similar to Android Compose and iOS Swift UI.
@RockWarCry
@RockWarCry 2 жыл бұрын
It looks a lot like Flutter`s and Swift UI`s way of composing UIs
@halfbakedproductions7887
@halfbakedproductions7887 6 ай бұрын
HUD Class is legacy and deprecated in UE5.
@NicoleSummer8
@NicoleSummer8 2 жыл бұрын
Awesome 🎉
@StefanJann
@StefanJann 5 ай бұрын
Thank you
@reubs
@reubs 4 жыл бұрын
1st
@HussainAhmad-kh3eo
@HussainAhmad-kh3eo 4 жыл бұрын
Hehehehe
@paulhax
@paulhax 4 жыл бұрын
Looks like good content. A suggestion: triple or more the editor text size. I can't read the code on my laptop screen.
@wisper8628
@wisper8628 3 жыл бұрын
very nice
@awoidf
@awoidf Жыл бұрын
7:20-7:24 yeah, that's also known as the stockholm-syndrome xD
@Muhammad_Abdullah_Sultan
@Muhammad_Abdullah_Sultan Жыл бұрын
Good
@VladyVeselinov
@VladyVeselinov 4 жыл бұрын
You can really tell Epic doesn't care about UI, every UI system they have is so clunky...
@reubs
@reubs 4 жыл бұрын
Try using cryengine! It uses flash lol
@VladyVeselinov
@VladyVeselinov 4 жыл бұрын
@@reubs oh my
@ivayloi736
@ivayloi736 4 жыл бұрын
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 4 жыл бұрын
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 4 жыл бұрын
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...
@РижаМавпа-ш8и
@РижаМавпа-ш8и 3 жыл бұрын
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.
@andrew6855
@andrew6855 4 жыл бұрын
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 4 жыл бұрын
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 3 жыл бұрын
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.
@devintrusdell5733
@devintrusdell5733 3 жыл бұрын
GOD loves y'all and have a Blessed day ✝️⛪🙏🙏🏻🙏🏼🙏🏾🙏🏽🙏🏿👼🏿👼🏾👼🏽👼🏼👼🏻👼😇🥰❤
@goken-san9224
@goken-san9224 3 жыл бұрын
My character and the camera isn't moving after adding the slate code. What can I do to fix this?
@quazitarik
@quazitarik 2 жыл бұрын
how do I load image from local drive instead of changing color to black
@GiacomoPerin
@GiacomoPerin 4 жыл бұрын
1st
Learn Unreal Engine C++ In One Hour
55:43
reubs
Рет қаралды 290 М.
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
UE4 Tutorial: Character Health Bar UI Using C++
22:01
_benui
Рет қаралды 15 М.
Make a Vehicle with C++ in Unreal Engine 4
26:20
reubs
Рет қаралды 74 М.
Making UIs With C++ in Unreal Engine, by Ben UI
32:40
JetBrains
Рет қаралды 25 М.
How I Remade MW2 with Unreal Engine 5
12:37
reubs
Рет қаралды 3,1 МЛН
Unreal Engine 4 UI: C++ & Blueprints UMG Workflow Tutorial
14:15
UMG Widgets with C++ in Unreal Engine 5
16:09
Lively Geek
Рет қаралды 40 М.
How to create Modular and Scalable UI systems in Unreal Engine
19:15
AmrMakesGames
Рет қаралды 100 М.
Learn Unreal Engine Networking in 30 Minutes
27:25
reubs
Рет қаралды 104 М.
Pause Menu Tutorial - Unreal Engine 5.1+
16:24
Lisowi
Рет қаралды 19 М.
The Unreal Engine Game Framework: From int main() to BeginPlay
27:22
Alex Forsythe
Рет қаралды 223 М.
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН