# ApexAsset for DestructibleMesh not loading on cooked game, but does on play in editor

**URL:** <https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613>\
**Category:** Platform & Builds\
**Tags:** Cooking, UE4-18, unreal-engine, Destructible-Mesh, question\
**Created:** [November 3, 2017, 2:57am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613 "2017-11-03T02:57:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [November 3, 2017, 2:57am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/1 "2017-11-03T02:57:06Z")

</div>

After migrating to UE 4.18 all destructible meshes in our game stopped working, except when running the game on PIE.

Debugging a little bit, I found at the moment of deserializing in UDestructibleMesh::Serialize the deserialized ApexAsset is NULL if running as cooked standalone game, but deserializes correctly if running from editor.

The cooking process didn’t give me any warning regarding destructible meshes. Any idea what I should be looking into?

**UPDATE:**

Debugging further I’ve found the NvParameterized serializer didn’t have the factory for “DestructibleAssetParameters” version 26 registered at the time of loading the destructible mesh assets.

Seems like the reason our destructible meshes are working fine when running from Editor is because Apex Destruction is properly initialized before the game assets are loaded, however, when running standalone (a configuration without editor) the game assets are loaded before FApexDestructionModule::StartupModule is called.

Is there a way I can force the module to load first?

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [December 14, 2017, 9:49am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/2 "2017-12-14T09:49:14Z")

</div>

I’m still getting this behavior in 4.18.2. Did you ever figure out a workaround?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [December 21, 2017, 10:00pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/3 "2017-12-21T22:00:24Z")

</div>

My work around was to load the DestructionModule when Apex is first initialized, instead of doing it in the plugin StartupModule (basically restoring what it was doing before 4.18).

I think other possible solution would be to not have any startup asset reference destructible assets (no direct or indirect references through base classes, singleton, etc), so that any destructible asset is loaded after all plugins have been initialized.

---

<div class="post-metadata">

**Author:** ![jcbjoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jcbjoe](https://forums.unrealengine.com/u/jcbjoe)\
**Post date:** [January 18, 2018, 10:18pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/4 "2018-01-18T22:18:15Z")

</div>

How could you go about this? Been struggling on this for around a week!

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [January 19, 2018, 2:57pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/5 "2018-01-19T14:57:18Z")

</div>

I’ve been working through this over here: [Destructible mesh loses collision and physics after packaging in 4.18.2 - World Creation - Unreal Engine Forums](https://answers.unrealengine.com/questions/736034/destructible-mesh-loses-collision-and-physics-afte.html)

There’s a bug ticket now, [Unreal Engine Issues and Bug Tracker (UE-54133)](https://issues.unrealengine.com/issue/UE-54133)

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [January 19, 2018, 2:59pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/6 "2018-01-19T14:59:34Z")

</div>

Same here, would love to know more about where apex is initialized.

Been trying to somehow spawn my destructible actor from my character class without actually referencing it… No luck so far

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [January 19, 2018, 3:05pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/7 "2018-01-19T15:05:22Z")

</div>

Basically added back LoadPhysicsLibrary for APEX\_Destructible in PhysXLibs.cpp (right after Legacy and Clothing are loaded) instead of loading it in the plugin.

---

<div class="post-metadata">

**Author:** ![jcbjoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jcbjoe](https://forums.unrealengine.com/u/jcbjoe)\
**Post date:** [January 19, 2018, 3:07pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/8 "2018-01-19T15:07:00Z")

</div>

Thank you so much for the reply! Really need this as its for a uni project thats in soon! Where abouts is the PhysXLibs.cpp in the engine folder?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [January 19, 2018, 3:13pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/9 "2018-01-19T15:13:05Z")

</div>

Engine\Source\Runtime\Engine\Private\PhysicsEngine

---

<div class="post-metadata">

**Author:** ![jcbjoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jcbjoe](https://forums.unrealengine.com/u/jcbjoe)\
**Post date:** [January 19, 2018, 3:26pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/10 "2018-01-19T15:26:40Z")

</div>

Thanks so much for this I really apreciate it! Ill try it when i get home and report back if it fixed the issue for me! But really thanks soo soo much. Theres so little info on apex destruction in c++.

Is loading the libary all i need to do? Or do i need to add the lib back or anything?

Thanks again!  
Joe

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [January 19, 2018, 3:44pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/11 "2018-01-19T15:44:17Z")

</div>

Look at what it does with the others and try to replicate it, you may need to modify headers too. You can also look for old revisions of the source code to compare.

---

<div class="post-metadata">

**Author:** ![jcbjoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jcbjoe](https://forums.unrealengine.com/u/jcbjoe)\
**Post date:** [January 19, 2018, 4:22pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/12 "2018-01-19T16:22:25Z")

</div>

So ive tried it and its stil not working, the apexdestructiveasset is still null, what headers would i need to change? Thanks again

---

<div class="post-metadata">

**Author:** ![jcbjoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jcbjoe](https://forums.unrealengine.com/u/jcbjoe)\
**Post date:** [January 19, 2018, 7:02pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/13 "2018-01-19T19:02:36Z")

</div>

Did you get it working @JMigCarrier? Theres so many files that the engine has in 4.17 and not in 4.18 in regards to destructiblemesh etc…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [January 21, 2018, 9:38pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/14 "2018-01-21T21:38:11Z")

</div>

Yes, I got it working, it’s not too difficult, but is not a single line change either.  
As I was telling you the key is loading the destructible module on PhysXLibs.cpp, you will need to add back an apex::ModuleDestructible\* GApexModuleDestructible pointer on PhysicsPublic.h, make ApexDestructionModule.cpp use that instead of loading it inside the plugin, and instantiate the module on PhysLevel.cpp (just like it does with Clothing or Legacy). The other Apex modules can work as example, replicate what they do or use the old source code as example.

---

<div class="post-metadata">

**Author:** ![jcbjoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jcbjoe](https://forums.unrealengine.com/u/jcbjoe)\
**Post date:** [January 21, 2018, 9:44pm UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/15 "2018-01-21T21:44:25Z")

</div>

Did you put the plugin in the project directory? or keep it in unreals dir?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [January 22, 2018, 1:05am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/16 "2018-01-22T01:05:21Z")

</div>

It’s on Unreal dir, didn’t move it.

---

<div class="post-metadata">

**Author:** ![jcbjoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jcbjoe](https://forums.unrealengine.com/u/jcbjoe)\
**Post date:** [January 22, 2018, 1:24am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/17 "2018-01-22T01:24:01Z")

</div>

Alright thanks, Ill keep trying. How do I make the ApexModule use the engine init and not the plugin one?

And are the files you listed the only ones that need editing?  
Sorry for all the questions its just for an assignment lol and im not that great at c++

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [January 22, 2018, 5:23am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/18 "2018-01-22T05:23:18Z")

</div>

@JMigCarrier This requires a full engine rebuild, correct? That may be a huge issue for me since the class library I use for my mod toolkit will need to work on vanilla 4.18

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [January 22, 2018, 11:48am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/19 "2018-01-22T11:48:17Z")

</div>

Correct, my workaround was to modify the engine.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ebcb3f91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ebcb3f91](https://forums.unrealengine.com/u/anonymous_user_3ebcb3f91)\
**Post date:** [January 22, 2018, 11:51am UTC](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613/20 "2018-01-22T11:51:51Z")

</div>

I really needed the engine to behave like it did before 4.18 for a commercial project, so I modified it. But a simpler solution would be to not have any destructible mesh referenced by any of initial assets that the game loads (for instance, only have those referenced by actors placed in the level), in that way the destructible plugin would have been already initialized when we time comes to load those destructible meshes.

[Next page](https://forums.unrealengine.com/t/apexasset-for-destructiblemesh-not-loading-on-cooked-game-but-does-on-play-in-editor/408613.md?page=2)
