I answered your question, and gave you a better solution.
This way is better.
Do you want an answer?
Or do you want someone else to write your code?
I answered your question, and gave you a better solution.
This way is better.
Do you want an answer?
Or do you want someone else to write your code?
thanks, but the original issue was to avoid duplication of blueprint nodes. This is why I was using the mapping. I already have the blueprint widget created on the fly based on the button text.
now I just need to continue and find a canvas panel within that widget blueprint. And the panel has a name. I just need to select this panel using the same (but modified) string I used to create the blueprint widget.
I thought you already solved that.
Yes… you must to use function.
Don’t know how to do it?
Wait until I give you an example
rokenrock commeee baaaaaack Ivan3z is eating my brain
Ok, I’ll let him help you. Good luck
I’m back lol
Unfortunately although enums would work great at first glance, they aren’t actually viable. You can’t easily parse strings to enums. They could probably work with enough refactoring, but I don’t like suggesting system reworks unless absolutely necessary.
The problem with using another map for panels is that those panels already exist, but we have no references to them.
How I would approach it is creating either an interface or base widget. Either works- just depends on how you want to do it.
For an interface, simply create an interface under blueprint->blueprint interface. Make sure the name makes sense- ie whatever you could simultaneously call all of the widgets.
Open it up an add a function- it already creates one when you create the interface so you can just rename that one. I’ve named it “GetTopLevelCanvas”
Then add a canvas panel as output and we’re done with this part
Then go into all your menus and add this interface. Class settings → Implemented Interfaces → Add
Then in your widgets, open the interface function as you would any other function
Then drag a reference to your unique canvas panel in there for every widget class with the interface.
Implementing it is easy- just use the result of the find node. Find nodes are pure (meaning every time you try to get a variable it will recalculate rather than how non-pure functions store the variables) so it will account for both already existing and just created references.
With that reference you can do whatever you wanted to before.
For a base class, I’ll just quickly explain the conceptual steps.
Create a user widget class, and add a function identical to that of the interface function (good name, returns canvas panel)
Change the parent class of all these widgets to be that just created widget (Class Settings ->Parent Class)
Override that function in all of the child classes with the same result of the interface
thanks, Im starting to think I just need to learn c++ as blueprints can become quite cumbersome after a while. thanks for laying this out. I will try and implement it. Its amazing how seemingly simple things can take alot of work around.
I do think people should learn C++, but I don’t think this is necessarily a turning point. If you do want to learn it, I highly recommend watching Cherno’s series. Although it’s generic C++, he’s a professional game engine developer who works at EA and gives great information.
He mentions in this first video that he’s just going to brush over the basics, but that’s not actually the case. He has dedicated videos for all the basics from setup to variables, functions, classes, enums appropriately, and constructors.
Also you really shouldn’t use an enum for time. Though even if you did all that code can be replaced with
if (LevelsTime == None || LevelsTime == MaxItem) return "--:--";
return FString::Printf(TEXT("%s:00"), *UEnum::GetValueAsString(LevelsTime).Right(2));
You’d need to add a value for 00:00 rather than using none, but that makes sense anyways since none should be for error catching rather than a valid state.
thanks yes, i am already working my way through the udemy course
’ Unreal Engine 5 C++ Developer: Learn C++ & Make Video Games’ - I will check out Cherno’s series also. I found some threads saying c++ maybe unnecessary for the menu’s aspect of a game. But I guess I can have some areas covered by blueprints, and some things c++ code.
It’s just to choose the party time.
But, definitely every day I learn something new.
Thank you very much rokenrock!!
It’s a good decision. Blueprints has many problems.
I only use them when there is no other remedy.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.