Level Up Your UI Communication with Unreal ViewModels

  Рет қаралды 3,319

AmrMakesGames

AmrMakesGames

Күн бұрын

If you are wondering, what is a better way to communicate data between gameplay code and UI? Is there is a better alternative to property binding, getting all actors or all widgets of class? How can utilize Event-Driven UI in Unreal? What are Viewmodels and How to use them? Then this video is for you!
We'll go over How to create view models in C++ and Blueprints. The different ways to create them. What are View Bindings, how to use them and what are some of the viewmodel Caveats?
Project Files:
drive.google.com/file/d/1ix5d...
🔴 Support me on Patreon:
patreon.com/AmrMakesGames?utm...
Resources:
docs.unrealengine.com/5.3/en-...
/ ue5-mvvm
Timestamps:
00:00 Intro
01:20 Creating a View Model
04:16 Initializing a View Model
08:12 View Bindings
09:09 View Model Caveats
10:24 Outro
Credits:
Music by Arcee on Soundcloud - / arsy1

Пікірлер: 38
@mertbiceroglu1949
@mertbiceroglu1949 2 ай бұрын
Please continue making videos on UI it is a big help.
@arrowsdev
@arrowsdev 4 ай бұрын
Wow totally new stuff never knew about this and it looks so cool and useful, i think I'll start fiddling around with it and see where it leads to
@arrowsdev
@arrowsdev 4 ай бұрын
Always great stuff brother keep it up ❤
@AmrMakesGames
@AmrMakesGames 4 ай бұрын
Always thankful for your support brother!
@Megzzz97
@Megzzz97 4 ай бұрын
I didn't understand View Models at first but this video helped me a lot, Amazing Video great job man 🙌
@AmrMakesGames
@AmrMakesGames 4 ай бұрын
Appreciate it a lot ya Megzzz! 🙏🙏❤️
@GokdenizCetin
@GokdenizCetin 4 ай бұрын
Thanks
@conneich
@conneich 3 ай бұрын
Thanks for these videos! A critique though: Lean back from the mic a bit as youre "popping" while talking. As long as you aren't too quiet you can always turn your vocal loudness up in your audio/video editor.
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
Thanks for the tip!
@tomasbacchiocca4151
@tomasbacchiocca4151 3 ай бұрын
Nice video, my question is: so every stat like health or stamina or inventory items for example are nomore variables on character and are only viewmodel variables or there are both, so character has the variables and then updating that also updates the viewmodel respective one?
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
Nice question. There is no right or wrong here, but I personally prefer to have a private variable inside my character class to have more control before I update the viewmodel.
@yourstarchan
@yourstarchan Ай бұрын
Hello! I just wanted to say that viewmodels in 5.4 did not allow me to do a lot of things that I would like to because of crashes. I spent 2 days and was unable to use them without pain. I'd rather reinvent my wheel until they at least fix set members in property
@AmrMakesGames
@AmrMakesGames Ай бұрын
Thank you for pointing that out, I didn't use them in 5.4 personally.
@cosmotect
@cosmotect 3 ай бұрын
Another question I have is this: Say I have an actor component "BPC_EntityHealth" which handles health related logic for the entity. How do I get it to write to the viewmodel instance which is being read by the UI? Is it okay to have the BPC coupled with the viewmodel? Or should I avoid that?
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
It's okay to couple the component to the viewmodel, and the UI to the viewmodel, but not the component to the UI. That is the purpose of viewmodels, being a medium for game and UI communication.
@cosmotect
@cosmotect 3 ай бұрын
@@AmrMakesGames gotcha, thanks :)
@FUnzzies1
@FUnzzies1 12 күн бұрын
A pop filter would go a long way
@AmrMakesGames
@AmrMakesGames 10 күн бұрын
Definitely need to invest in one soon!
@FUnzzies1
@FUnzzies1 10 күн бұрын
@@AmrMakesGames still a great video!
@cosmotect
@cosmotect 3 ай бұрын
Amr, I am very confused. How are you using global view model collection in your projects? The "Get Global View Model Collection" node is missing in 5.3. I am not able to use this method of initialization. Even the documentation page for the node is missing in 5.3 while present in 5.2
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
Hey Cosmotect, sorry for your confusion, there has been some changes to the MVVMSubsystem in 5.3. Make sure you're using the MVVMGameSubsystem, not MVVMSubsystem. You can find an example of this in the project files I left in the description, exactly inside BP_Character's FetchHealthGlobalViewmodel function.
@cosmotect
@cosmotect 3 ай бұрын
@@AmrMakesGames yeah, I realized that they moved and changed some things, I will try to figure it out on my own one more time, but if I can't Ill refer to your project files. Thank you for this tutorial by the way. Really looking forward to the rest of the series
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
@@cosmotect glad I could help and good luck with it!
@cosmotect
@cosmotect 3 ай бұрын
@@AmrMakesGames So, I downloaded the project files, and when I tried to open it with 5.3.2 I got this error message: "The following modules are missing or built with a different engine version: Viewmodels. Would you like to rebuild them now?" If I press "yes", I then get this error: "Viewmodels could not be compiled. Try rebuilding from source manually."
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
@cosmotect do you have Visual Studio installed, and can you try searching how to compile Unreal C++ code?
@AhmadRocks
@AhmadRocks 3 ай бұрын
Hi Amr! I have downloaded the project file view models but it showing error cant compile, it says i need to rebuild from source manually. I did from VS and still showing build error.. please update the project link. Thanks!!
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
Hey Ahmad, thank you for letting me know. Project link is updated!
@AhmadRocks
@AhmadRocks 3 ай бұрын
@@AmrMakesGames Still not working its the same issue still?
@AmrMakesGames
@AmrMakesGames 3 ай бұрын
@@AhmadRocks Can you please double-check it? What engine version are you using and Can you show me the build error from VS?
@AhmadRocks
@AhmadRocks 3 ай бұрын
@@AmrMakesGames I am using UE5.3.2 the latest one, Also can you send me your twitter username or email? to send screenshots of it?
@AhmadRocks
@AhmadRocks 3 ай бұрын
@@AmrMakesGames I am using UE5.3.2 (latest build) but still not working even after regen VS project files and saying build complete then when I open the project it shows "Viewmodels could not be compiled. Try rebuilding from source manually." So I tried building from VS 2022 and this is what says: 1>------ Build started: Project: Viewmodels, Configuration: DebugGame_Editor x64 ------ 1>Building ViewmodelsEditor... 1>Using Visual Studio 2022 14.39.33521 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10). 1>Determining max actions to execute in parallel (6 physical cores, 12 logical cores) 1> Executing up to 6 processes, one per physical core 1> Requested 1.5 GB memory per action, 4.63 GB available: limiting max parallel actions to 3 1>------ Building 10 action(s) started ------ 1>[1/10] Compile [x64] SharedPCH.Engine.NonOptimized.Cpp20.cpp 1>E:\UE_5.3\Engine\Source\predefined C++ types (compiler internal)(420): error C2248: 'FHazardPointerCollection::FHazardRecord::FHazardRecord': cannot access private member declared in class 'FHazardPointerCollection::FHazardRecord' 1>E:\UE_5.3\Engine\Source\Runtime\Core\Public\Experimental\Containers\HazardPointer.h(86): note: see declaration of 'FHazardPointerCollection::FHazardRecord::FHazardRecord' 1>E:\UE_5.3\Engine\Source\Runtime\Core\Public\Experimental\Containers\HazardPointer.h(77): note: see declaration of 'FHazardPointerCollection::FHazardRecord' 1>E:\UE_5.3\Engine\Source\predefined C++ types (compiler internal)(420): note: the template instantiation context (the oldest one first) is 1>E:\UE_5.3\Engine\Source\Runtime\Core\Public\Experimental\Containers\HazardPointer.h(133): note: see reference to function template instantiation 'void __builtin_array_init_helper(_T *,size_t) noexcept()' being compiled 1> with 1> [ 1> _T=FHazardPointerCollection::FHazardRecord 1> ] 1>Total time in Parallel executor: 22.33 seconds 1>Total execution time: 23.17 seconds 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "E:\UE_5.3\Engine\Build\BatchFiles\Build.bat ViewmodelsEditor Win64 DebugGame -Project="D:\Ahmed\UE5\My Projects\Viewmodels\Viewmodels.uproject" -WaitMutex -FromMsBuild" exited with code 6. 1>Done building project "Viewmodels.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 10 up-to-date, 0 skipped ========== ========== Build completed at 8:23 PM and took 23.624 seconds ==========
Interface, Abstract, or Component (When should I use What?)
11:54
How to ACTUALLY Load Levels in Unreal and Make Loading Screens
16:31
The Game Dev Cave
Рет қаралды 31 М.
Универ. 10 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:04:59
Комедии 2023
Рет қаралды 1,3 МЛН
小女孩把路人当成离世的妈妈,太感人了.#short #angel #clown
00:53
Каха ограбил банк
01:00
К-Media
Рет қаралды 2,3 МЛН
Even MORE Sneaky Tricks Most FPS Games Use
3:42
Garbaj
Рет қаралды 730 М.
Stop Casting! use blueprint Interfaces Instead!
11:56
The Game Dev Cave
Рет қаралды 7 М.
Tic Toxic Studios - AI Controlled NPCs in Unreal Engine 5 - Part 1.
13:08
The Truth About Freelancing as a Game Developer
11:13
AmrMakesGames
Рет қаралды 1,1 М.
Procedural Room Generation Methodology
12:16
Gordon Vart
Рет қаралды 10 М.
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 90 М.
Making UIs With C++ in Unreal Engine, by Ben UI
32:40
JetBrains
Рет қаралды 20 М.
Blueprint VS  C++ in Unreal Engine 5, Which One Should You Choose ?!
7:26
Unreal ART With Alireza
Рет қаралды 31 М.
Unreal Engine 5.4 Motion Matching in 13 Minutes | 2024
13:41
Reality Forge
Рет қаралды 84 М.
Универ. 10 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:04:59
Комедии 2023
Рет қаралды 1,3 МЛН