x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

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?

Product Version: UE 4.18
Tags:
more ▼

asked Nov 03 '17 at 02:57 AM in C++ Programming

avatar image

JMigCarrier
46 1 6 13

avatar image SlimeQ Dec 14 '17 at 09:49 AM

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

avatar image JMigCarrier Dec 21 '17 at 10:00 PM

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.

avatar image jcbjoe Jan 18 '18 at 10:18 PM

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

avatar image SlimeQ Jan 19 '18 at 02:59 PM

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

avatar image JMigCarrier Jan 19 '18 at 03:05 PM

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

avatar image jcbjoe Jan 19 '18 at 03:07 PM

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?

avatar image JMigCarrier Jan 19 '18 at 03:13 PM

Engine\Source\Runtime\Engine\Private\PhysicsEngine

avatar image jcbjoe Jan 19 '18 at 03:26 PM

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

avatar image JMigCarrier Jan 19 '18 at 03:44 PM

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.

avatar image jcbjoe Jan 19 '18 at 04:22 PM

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

avatar image jcbjoe Jan 19 '18 at 07:02 PM

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..

avatar image JMigCarrier Jan 21 '18 at 09:38 PM

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.

avatar image jcbjoe Jan 21 '18 at 09:44 PM

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

avatar image JMigCarrier Jan 22 '18 at 01:05 AM

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

avatar image jcbjoe Jan 22 '18 at 01:24 AM

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++

avatar image JMigCarrier Jan 22 '18 at 11:51 AM

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.

avatar image jcbjoe Jan 22 '18 at 12:00 PM

What about if i need to use a construction helper loading a uDestructibleComonent? Which has to be done on construct

avatar image JMigCarrier Jan 22 '18 at 02:13 PM

I would avoid loading the asset on the C++ constructor, instead using a BP subclass and setting the asset reference there, then placing the BP on the map. link text I'm attaching the annotated source files I've modified.

enginechanges.zip (26.5 kB)
avatar image jcbjoe Jan 22 '18 at 02:22 PM

Really apreciate that thanks for all the help

avatar image SlimeQ Jan 22 '18 at 02:30 PM

Heads up, setting the asset reference in bp was also broken for me. My solution was to use StaticLoadObject to actually load the class at runtime from a string

avatar image jfmoser Mar 09 '18 at 09:45 AM

thank you so much for this patch. worked like a charm and saved our milestone :)

avatar image SlimeQ Jan 22 '18 at 05:23 AM

@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

avatar image JMigCarrier Jan 22 '18 at 11:48 AM

Correct, my workaround was to modify the engine.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I actually found a workaround for this issue. It is critical that the destructible mesh not be referenced is not referenced (even indirectly) by a character or other startup asset. Since this makes it impossible to keep a proper reference, I'm instead keeping a FString reference and then loading it when it's needed using StaticLoadClass like so:

 UClass* Result = StaticLoadClass(UObject::StaticClass(), nullptr, *ClassName, nullptr, LOAD_None, nullptr);

It's ugly, and may put undue stress on the HDD but technically it works.

more ▼

answered Feb 08 '18 at 10:04 PM

avatar image

SlimeQ
327 10 21 37

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question