Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
956 B
3
Indexable
Never
public void CustomCreateText(Vector3 position, string text, DynamicTextData data, Color color)
{
    GameObject newText = Instantiate(canvasPrefab, position, Quaternion.identity);
    newText.transform.GetComponent<DynamicText>().Initialise(text, data);

    //newText.transform.GetComponent<DynamicText>().startColour = color;

    //data.colours.SetValue(color, 0);
    //data.colours.SetValue(color, 1);
    
    PlayReinforcmentSound();

    if (textVFX_01 != null)
    {
        // Instantiate the particle system at the position
        ParticleSystem instantiatedVFX = Instantiate(textVFX_01, position, Quaternion.identity);

        // Play the particle system
        instantiatedVFX.Play();

        // Destroy the particle system after its duration
        Destroy(instantiatedVFX.gameObject, instantiatedVFX.main.duration);
    }
    else
    {
        Debug.LogError("No particle system template assigned.");
    }
}
Leave a Comment