Run code before packaging

I’d like to run some code before my game is packaged (from the editor, not the Unreal Front End). Is there a delegate I can bind to that gets called before packaging starts?

Hello ,

I know a couple of people who may be able to give me some suggestions but I would need to know what you aim to do. Could you give an example of what you’re trying to have called prior to the packaging process?

We have a custom UAsset type in our project for dialog and we found that one of the files got out of sync with the graph (the graph was correct but some dialog lines led to the wrong place when we ran through it in game). We’re not sure how that happened but I was able to write a function that makes sure everything is synced up correctly and want to run it automatically before we package.

From what you describe that you need to do, it seems like the best way to do this would be to override Serialize, use Ar.IsSaving() && Ar.IsCooking() to make sure the engine is packaging, execute your logic, and then call Super::Serialize. If you’re looking for a more reactive solution that won’t involve adding more logic to every time it needs to be loaded, a commandlet may be best, but you would need to already know it has gone bad and do it manually.