I’m reading Unreal official guide. UI, Animation, every section uses blueprint. Is not possible to evoid blueprint and use only c++?
Yes it is! All blueprint classes are based on C++ code.
You can, but it takes some work. The c++ equivalents are not well documented. I’ve found that c++ code is better behaved compared to blueprints.
My current project is probably 95% C++ code (grabbing a random high number from thin air). However, it is extremely useful in certain situations to extend your base classes with blueprints. That and working on the UI with UMG widget blueprints is definitely better than trying to do it in C++ with Slate. So, you absolutely can avoid blueprints, but I think the engine is used best when mixing code and blueprints and finding a balance that works for you.
Ok, thank you.
My project is 100% C++ and staying that way. Contrary to snidersh, I’ve made my entire game UI with Slate and I’m of the opinion it’s a valid choice. I wouldn’t use graphical scripting for complex UI, it would be too much of a mess. We’ve got maybe 15 000 lines of C++ code for UI.
Blueprints help test and iterate faster but I believe it’s better to move it to C++ once your prototype is working like you want. Then data blueprints are very convenient but it is possible to do everything in C++, is it a wise choice ? Not sure… you can chose to take advantage of the best of both worlds.
Gwenn, that’s a massive UI! You’re right though, if I was working on a project that had that level of complexity for the UI vs some menus and some on-screen HUD panels, it would be a whole lot easier to manage in C++ vs UMG. Once you hit a certain number of nodes, blueprints becomes very difficult to manage and you often have a sprawling mess vs a few lines of code. I can’t even imagine what 15,000 lines of C++ code would translate into in blueprints; it would be a visual nightmare.
EDIT - I just checked out your game Helium Rain. I love games like that… and now I understand the 15k lines of UI code!
I also believe Blueprint/UMG is fine for a shooter HUD and menu. It’s really a matter of how complex it is.
At 15k lines, that has to be one good looking UI. Screenshots?
I started learning the Unreal Engine with Blueprints and I can say I didn’t feel at home since I have C++ knowledge. It is a mess, and I find a lot easier doing algorithms in C++ rather than Blueprints
Absolutely amazing! Great job… Clean, elegant, etc. Love the fonts… So, no UMG at all?
BP’s are kinda cool because they helped me learn the API (actually, I’m still learning!). But, I agree. Did a smooth zoom in C++ with a lot less time and effort than in BP’s… (still learning C++ too…)
Looks really great, guys!
I’m using C++ only for gameplay and UMG for menus, but I find UMG extremely unstable - the only place in UE4 where I get crashes constantly at least one per hour.
May I ask you to describe your experience coding UI with Slate? Just how hard it could be comparing to basic game logic coding. Thanks!
Well in some regards Slate code is almost alien to the gameplay code. Some + and - :
- It’s really easy to define new widgets, new events, new parameters in your new widget…
- It’s really easy to work with dynamic data. Having a text, an icon, an alpha value that changes with the game’s state is as simple as it could hope to be.
- If you’re making a complex UI with a lot of shared graphical assets that you may want to change at some point, there is a “style” mechanism which lets you define style assets in the content browser, with a graphical editor. The setup is a bit complicated (Rama has a wiki tutorial on this) but it’s great.
- Movement in Slate is close to impossible. Not sure about whether UMG is better.
- Overlapping widgets are close to impossible. You can write a custom layout class or you can just add another UI layer, but it’s really painful.
- Some base widgets are really limited in a painful way. You can’t use a combo box and change the highlight color (bright yellow). You can’t make a slider with a background that is larger than the thumb. Etc.
- So really, you need a custom widget for everything, including buttons.
- Slate widgets don’t inherit UObject, for example, so everything you thought you knew goes out of the window. Using game objects in the UI can be really painful, with Slategoing as far as making you declare a structure to store references to UObjects, in some cases.
As far as UI frameworks go, well it’s much less worse than Scaleform from a programmer’s perspective, more programmer-oriented than HTML, and maybe more intuitive than Qt. It’s supposed to be close to WxWidgets, apparently. I’m not sure if it’s just Stokholm syndrome or if it’s good UI framework, but I’ve been writing Slate code for a year now and I’m always fine with doing more, so it’s not that bad.
Thank you, Gwenn
I guess I’ll take a look at Slate and practice a little bit to decide which way is more suitable for me now