Hi All,
We are exploring the best approach to provide data driven level editing functionality for our designers.
At the moment I have a subclass of UDataAsset that stores some information for actors that should be spawned in the level.
In order for this to work nicely in the editor, these actors are being spawned as actor components during construction.
This works well, the problem however is that when the designer changes some values in the data asset the change is not immediately propagated to the level. I am required to manually trigger an update by moving actor responsible for the spawning.
So the question is what can I do to cause the refresh to happen as soon as values in the data asset changed? or at least on save of the data asset?
I’m open to suggestions for engine customizations as well. I was looking into FEditorDelegates but unfortunately there currently doesn’t appear to be one that is broadcast on asset dirty/change or save.
Perhaps its something that could be added though.
Thanks!
After some more digging around I was able to use UPackage::PackageMarkedDirtyEvent to send out the required notification that my asset has changed.
One thing I would like to be able to do now is find all references to my asset in the current scene so that I could easily filter which actors I need to update.
In case anyone is interested, using the package dirty event doesn’t quite work because Packages are marked dirty in pre event handlers so if you query property values after package is marked dirty you won’t get the new results.
Therefore, I switched to using OnObjectPropertyChanged instead.
I move each item 1 unit, then back after I spawn them which gets the paths rebuilt. That may be a hack, but it’s worked for a year through all the engine updates.
If you haven’t already make sure you package a game and test it. I found out the hard way about what is available and working in the Editor is not necessarily part of the runtime.
Thanks for the tip!
Luckily in this case the elements are static during the runtime so it’s one less headache to deal with 