I’m looking for a way to make data validation for values input to properties in the Details window in the editor. I’m a designer so I’m not good with code. Recently I saw some examples of how many things can be done in Blueprints via Create → Editor Utilities.
Does anyone have experience with that? Basically I want to get an event when the property changes value and then react if the new value is not allowed. This should happen when editting Actors in the editor, not ingame.
I’ve been trying with Editor Utility Blueprints and Editor Utility Widgets but could not find any way to do it. I found ‘Bind Event to On Property Changed’ but it requires PropertyViewBase as target and I don’t know how to get that.
Edit:
I found that in EditorUtilityWidget you can add SinglePropertyView and then bind it using OnPropertyChanged. But In my case I want it to react to change to Transform’s Rotation. So I cannot create a new property but connect to an existing one. Don’t know how to do that…
You can call OnPropertyChanged from both. But I’ve seen that variables like Vector, Rotator or Transform aren’t supported in SinglePropertyView. So you can do it with the DetailsView or make 3 separate floats with SinglePropertyView, one for each axis of the rotation.
Also, you may need to connect your object data to the widget variables.
Yeah, I’ve been doing a similar thing - I store and check change in rotation in the Construction Script. It just feels hacky and not optimal. I hoped there was a better way. But thanks your idea will work too.
I was able to execute stuff when the properties get changed like the image below (listening to the Event Pre Construct).
I decided to create a reusable button with the ability to change its text manually in the editor of the WidgetBlueprint using it. So that I can have multiple instances of the same button with different texts.
If I got it correctly, the Event Pre Construct will get executed every time a modification is done in any element of this whole Widget.
That is why I did not need to connect my text field.
I’ve encountered an issue when I add two or more widget components that utilize this technique. When I re-open the editor after adding the second button instance, the editor throws an unhandled null exception in Widget.cpp’s GetExtension method. SO far I’ve not been able to determine where the null comes from or why it (mostly) only errors when opening the editor.