Crash using ClassDefaultObjects

i have an ability system similar to GAS.

my use case is to run checks on the CDO before Instantiating the UObject (ie has enough ActionPoints)

i believe this is what GAS does for Non-Instantiated Objects.

On first run in PIE everything works, and the second run i get random crashes in what seems to be a Nullptr. Although all my pointers are validated.

my only possible guess is somehow the CDO is getting GC’d after the first run of PIE? but honestly i have no clue.

Anyone else have experience with this?

Hi,

Hope you’re doing well.

Have you tried run in debug mode in order to see where is the actual crash is happening?

Maybe is another stuff, and not your custom GAS.

Hope that helps, let us know any update.

yep, i forgot to mention when i add breakpoints it just didn’t crash at all :rofl:

the error is the usual failed to access 0000xfff (or whatever it is) which is why im guessing GC’d

but would CDOs get GC’d and it is referenced… i should also mention that since im using the CDO i dont change any of its values.

hahaha
This is crazy, I think this bug took some antibiotic debug and is now resistant to the debug :rofl:

I think the issue here is UPROPERTY, check if you don’t have any pointer without that.

i know right, its only because the CDO stuff is relatively new and ‘seems’ to not crash when i take it out that i think its related.

wait in typing this i just think i figured it out.

CDO’s dont have WorldContext (i need it for debugging ie printstring) so i set it once on first call (first PIE), the on (Second PIE) it might be trying to reference the old world…

I cant get in editor to check right now but it makes sense

1 Like

You mean are you trying to create CDO on runtime?

No CDOs auto create as soon as they are referenced. but since they can be referenced in editor they dont have access to a worldcontext because the world doesnt exist yet.