Hello there, I have a problem where my Soft Pointer is invalid. However, this isn’t happening to all of the assets. There are some assets that invalid if I check the validity of the Soft Pointer:
if (!WeaponTrailTemplate.IsValid())
{
return;
}
This is happening on Packaged game and Standalone game.
All of the invalid assets are already cooked properly (I already check on the .pak file and they are there). If I use Hard Reference, that invalid asset is loaded and worked.
I’m confused about what is the trouble, since only some of them are invalid, I think the problem isn’t with my code.
This is WeaponTrailTemplate by the way:
UPROPERTY(Transient, EditAnywhere, Category = "Components")
TSoftObjectPtr<UParticleSystem> WeaponTrailTemplate;
I initialize it from Blueprint so the path should be handled automatically (I log the path and it’s correct) but still invalid.
Do you have any idea about this? Thanks!
Here is the code:
void AWeapon::LoadWeaponTrail()
{
if (!WeaponTrailTemplate.IsValid())
{
return;
}
WeaponTrailHandle = UAssetManager::GetStreamableManager().RequestAsyncLoad(WeaponTrailTemplate.ToSoftObjectPath(),
[this]()
{
if (WeaponTrail)
{
if (IsValid(WeaponTrailTemplate.Get()))
{
WeaponTrail->SetTemplate(WeaponTrailTemplate.Get());
WeaponTrail->SetFloatParameter(TrailLifetimeParam, TrailLifetime);
}
}
if (WeaponTrailHandle->IsActive())
{
WeaponTrailHandle->CancelHandle();
}
});
}