Unity Custom Particle System – Test #1

Below are the functions I’m using to set scale and color. This is the first attempt. It seems to work OK but perhaps it can be improved on;

void SetColor()
{
mat.SetColor("_TintColor",
new Color(Mathf.Lerp(startColor.r, endColor.r, lifeCounter / life), Mathf.Lerp(startColor.g, endColor.g, lifeCounter / life), Mathf.Lerp(startColor.b, endColor.b, lifeCounter / life), Mathf.Lerp(startColor.a, endColor.a, lifeCounter / life)));
}

void SetSize()
{
transform.localScale =
new Vector3(Mathf.Lerp(startSize.x, endSize.x, lifeCounter / life),
Mathf.Lerp(startSize.y, endSize.y, lifeCounter / life),
Mathf.Lerp(startSize.z, endSize.z, lifeCounter / life));
}

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.