How to avoid hardcode? (UPrimaryDataAsset)

Hi Ivan,

Hmm i don’t have much experience with primary data assets, though i’ve been looking at them and want to try them out.

Sounds like an interesting approach, but in my experience attempting to separate assets depending on platform is difficult. I think that ue itself needs certain info about other assets and it’s really hard to separate them. so…

it might. assets bundles are relatively new and still under development, iirc.

as for network stuff specifically i’d be a bit scared (for a lack of better word) to separate the assets, since there has to be binary integrity between both the client and server. i imagine it’s quite possible that in order to run the server ue might need to touch or see the client assets (at least while packaging). it’s very possible that an asset is loading indirectly other assets in ways that break other stuff.

also don’t forget that, iirc, cpp classes are always loaded. so it might mean that a class might be referencing an asset and you might think it won’t be loaded.

i tend to set asset references on constructor using fconstructorhelpers a ton, so i tend to keep that in mind.

have you considered chunking ? that’s a more older way of splitting assets. it’s a bit more limited than assets bundles but might be more reliable. as i imagine it had more time to stabilize.

i’m not sure but i think assets bundles might give new features for the new smart loading technology (i think on ps5 they were using it). i’m not sure you need that. It also might behave better with iostore (ucas/utoc). which i think is an “either or” option with paks.

Is that your own asset or one from the engine?
i wonder if you need to include the clientessential in your primary assets to scan, or maybe in one of your primary assets (like shared) or maybe in both server and clients.

here’s an interesting post by Ari [Solved] Troubleshooting Primary Assets

where he said

You are also able to specify different pak chunks for your primary assets, separating the pak files in your game.

So maybe you can use just one primary asset (like you said you did and worked) , and then specify different chunks for each one of your sections (server/client/shared). it might give you a close enough result to what you’re looking for.

and i’m sure you’ve seen these links, as i’ve seen them a few times, but maybe rubber-ducking sparks an idea. (also for people looking for help on the matter, which helped me a lot before)

i’m glad to help, best of lucks to you, keep it up, im sure you’ll settle on a the optimal alternative for you. <3 good luck :slight_smile:

pd: “asset bundles” is such a difficult thing to search online. it shows stuff from fab and gamesfromscratch.

1 Like