Untitled

 avatar
unknown
plain_text
a year ago
956 B
7
Indexable
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.");
    }
}
Editor is loading...
Leave a Comment