I am trying to create a radial menu with buttons. I can get the menu to work, but the outline of the actual buttons are still rectangular, so the buttons overlap each other. In the screen shot, the button is activated when clicked anywhere in the green box, not the blue button. Is there any solution to this? Or are rectangular buttons still the only solution?
This is what you are looking for. The feature in UMG is called Advanced Hit Test and allows you to use any shape you want using a mask.
Awesome. That is it. I can’t seem to get the button to show up in the widget editor. I followed his steps and added my project name, but I may not have them copied into the right folder. What exact folder are the 2 files supposed to be copied into?
Ah, sorry about that. Forgot to mention that you have to have Visual Studio installed and be compiling your C++ project. I always assume everyone uses UE4 this way. If you have that setup, then do the following (I just followed these steps and confirmed it works in 4.13):
Copy the files to the Source/[YourProjectName] folder
Add them to your C++ project
In your [YourProjectName].Build.cs file:
Add UMG so the line looks like this:
PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “UMG” });
Then in the same file, un-rem out PrivateDependencyModuleNames.AddRange(new string[] { “Slate”, “SlateCore” });
Replace both occurrences of TESTPROJECT_API in the OvodusButton.h file with [YOURPOJECTNAME]_API
In OvodusButton.cpp add:
#include “[YOURPOJECTNAME].h”
above the line:
#include “OvodusButton.h”
Add the following two lines to [YOURPROJECTNAME] .h under the #includ “Engine.h” line:
#include “Runtime/UMG/Public/UMG.h”
#include “Runtime/UMG/Public/UMGStyle.h”
Compile your project and run it. In the UMG editor you will now see the OvodusButton show up in the palette.
Oh ok. So this only works if you are using C++? I have never set up my project that way, so I guess that’s why it isn’t working…
Yep, this requires C++, because it is custom functionality that is not included in UE4. Even if you have no plans to program in C++, I recommend setting up the environment so you have more options. One of the greatest things about UE4 is the way you can mix blueprints and C++ in the same project. I always create my projects as blueprint projects, but then use C++ to fill in the missing functionality that is not included in UE4. All you have to install is this: Visual Studio 2022 Community Edition – Download Latest Free Version
I see. I have always just been scared of C++, but you’ve convinced me. When I set up my projects now, should I use the C++ templates, then just use Blueprints as normal, until I need to include some kind of C++ feature? Or is there a better way to set up my projects to use both Blueprints and C++?
There are many ways to do it, but here is what I do. I always start with a blueprint project. Then when I need to add C++ functionality, I choose “New C++ Class” from the File menu in UE4. Then it asks you to pick a Parent Class. Character and Actor are the most common ones I use. Give it a name and then click Create Class. The first time you do this in a blueprint project, UE4 will automatically setup your C++ project for you (if you have Visual Studio 2015 Community Edition installed). Once you do this to your existing project, you can follow my steps above for adding that new UMG button.
The best way to think about it is that UE4 is a collection of tools that Epic has built. Blueprints only allow you to use tools that are already built. C++ allows you to build new tools and then use them in your blueprints.
Dude, you’re my hero. I got it working now. The only thing I had to change was in the OvodusButton.h, instead of replacing the TESTPROJECT_API, I just deleted it. When I replaced them, I was getting all kinds of errors. Just deleting gave me no errors and it all works. Not sure why though. Thanks for all the help!
Ok, great! Glad you got it working. Be sure to mark the answer by clicking on the checkmark next to the first answer so other people with the same question as you can find it. Thanks!