Skip to content

UIText not always showing up #164

@t0n1zz

Description

@t0n1zz

So i using uitext to showing pop up text that show amount of score player from each enemy that destroyed and it show up only in the beginning of the game after the enemies getting more and more the uitext start being weird, first the "+" disappear and after that it only show 0 and then not showing anything....

any idea why? or maybe my way of implementing it wrong?
i put this script in my enemies gameobject

bellow is the void for handle taking damage and showing pop up text when enemies dies

public void Damage(float damageCount)
{
    hp -= damageCount;
    healthMeter -= damageCount;
    if (healthMeter <= 0)
    {
        if (hp > 0)
        {
            healthMeter = 1;
        }
    }
    if(hp <= 0)
    {
        healthMeter = 0;
        SpecialEffectHelper.Instance.Explosion(transform.position);

        if (isEnemy)
        {
            int points = scorePoint * gameGUIScript.combo;
            var text = new UIText("spritefont", "spritefont.png");
            UITextInstance pointText = text.addTextInstance("+" + points,0,0);
            pointText.textScale = .7f;
            Color pointTextColor = pointText.color;
            pointTextColor.a = .3f;
            pointText.color = pointTextColor;
            pointText.positionFromTopRight(.06f, .08f);
            pointText.alphaTo(.5f, 0, Easing.Linear.easeIn);
        }
        Destroy(gameObject);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions