CreateFloatingText

Method

Creates a floating text object

Definition

void CreateFloatingText(string text, FloatingTextAnimStyle style, Vector3 position, Vector3 force, Color color, bool gravity = false, AnimationCurve scaleCurve = null, AnimationCurve alphaCurve = null, float lifetime = 1)
void CreateFloatingText(string text, FloatingTextAnimStyle style, Vector3 position, Vector3 force, Color color, bool gravity = false, AnimationCurve scaleCurve = null, AnimationCurve alphaCurve = null, float lifetime = 1)

Parameters

ParameterDescription
string text

Text to render

FloatingTextAnimStyle style

Animation style

Vector3 position

Position to place floating text

Vector3 force

Impulse force of the object once it appears

Color color

Text color

bool gravity

Use gravity?

AnimationCurve scaleCurve

Animation curve for scaling

AnimationCurve alphaCurve

Animation curve for alpha

float lifetime

Time to keep text visible

Examples

int healthPoints = 1000;

public void DealDamage(int damage)
{
healthPoints -= damage;
SpatialBridge.vfxService.CreateFloatingText($"{damage}!", FloatingTextAnimStyle.Bouncy, transform.position, Vector3.up, Color.red);

if (healthPoints == 0)
Destroy(gameObject);
}
int healthPoints = 1000;

public void DealDamage(int damage)
{
healthPoints -= damage;
SpatialBridge.vfxService.CreateFloatingText($"{damage}!", FloatingTextAnimStyle.Bouncy, transform.position, Vector3.up, Color.red);

if (healthPoints == 0)
Destroy(gameObject);
}