Instantiate bigger objects if number is bigger

I’m making a damage pop up system and i want to make it so if you make more damage the popup text becomes bigger :smile:

This is my Instantiate script:

public static void CreateFloatingText(string text, Transform location)
    {
        FloatingText instance = Instantiate(popupText);
        Vector3 screenPosition = new Vector3(location.position.x + Random.Range(-5f, 1f) + 943, location.position.y + Random.Range(-1f, 1f) + 400);

        instance.transform.SetParent(canvas.transform, false);
        instance.transform.position = screenPosition;
        instance.SetText(text);
    }

thx

Create a third parameter that takes the damage you are dealing. public static void CreateFloatingText (string text, Transform location, float damage)
then do something like instance.transform.localScale = Vector3.one + (Vector3.one * damage * some float that will give you the results you’re aiming for);

1 Like

Thanks! but if i want to add the size instead of multiply it, how do i do that?
so instead of instance.transform.localScale = Vector3.one + (Vector3.one * amount);
maybe like:

instance.transform.localScale = Vector3.one + (Vector3.one += amount);

but that gives me this error:

Operator `+=' cannot be applied to operands of type `UnityEngine.Vector3' and `int'