Hi! I need change material parameter value for Particle System (mesh emitter, with 1 material on it) this code invoke when Projectile hit some thing, and it do not work((
UParticleSystemComponent* PS = UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ExplosionEffectExplosion, pos, GetActorRotation(), true);
if (PS)
{
UMaterialInterface* Material = PS->GetMaterial(0);
if (Material)
{
UMaterialInstanceDynamic* MatInstance = UMaterialInstanceDynamic::Create(Material, PS);
MatInstance->SetScalarParameterValue("MAT_TIME_NORMALIZED", 0.1f);
if (MatInstance)
PS->SetMaterialParameter("MAT_TIME_NORMALIZED", MatInstance);
}
}
how to change params for PS any ideas about this ?