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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s