#Unreal Objects owned by Actors in a

1 messages ยท Page 1 of 1 (latest)

carmine pivot
#

Hey Dan! I'm continuing this because I made some tests and I don't manage to make it work like you suggested.
As you suggested, I created an object reference to my component (PersistentAmbComponent in this case) in a GameInstance class. However, on level change, I still have OnComponentDestroyed that gets called. What am I missing/not seeing?
(and if you feel this discussion is best had somewhere else, don't hesitate to tell me!) ๐Ÿ˜„ Thanks a lot for your help โค๏ธ

thorn wadi
#

What is the super class of UPersistentAmbientComponent? is it a regular uobject?

astral cobalt
#

Are those Blueprints in an Actor class?

thorn wadi
#

BTW looking at the code for audio component persistance it seems you can just create a persistent audio component -

#

though it's still a USceneComponent so will probably get garbage collected if it's not a reference somewhere (you can also try AttachToRoot() to make it not garbage collectable until you release it, probably)

carmine pivot
carmine pivot
thorn wadi
carmine pivot
thorn wadi
#

Even though now that I look at it USceneComponent is derived from UActorComponent so UAudioComponent is also an actor component. but still, might be worth trying for a UObject

astral cobalt
#

Garbage Collection will attempt to destroy child objects. Only a strong pointer with a UPROPERTY macro will prevent its destruction.

#

TObjectPtr

#

But it's easier if you can assign the persistent object to be its owner.