Access widget functions from another class

how would I be able to call a widget function from another class?

let’s say in projectile I want it to access a ShowDamage widget where ShowDamageWidget displays the damage pts and holds a function that sets the Damage pt.

How would I be able to call that setDamagePt in ShowDamageWidget from another class?

You don’t call functions on classes. You call functions on instances of classes.

You would need a pointer to that instance and set it when you spawn the projectile. i.e.

AProjectile* Projectile = GetWorld()->SpawnActor<AProjectile>(....);
Projectile->SetWidget(YourWidget); // create this function on your AProjectile

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms