Unity Custom Particle System – Test #1

[youtube https://www.youtube.com/watch?v=aPAClildoo0&w=560&h=315]

[youtube https://www.youtube.com/watch?v=gZVcmomfVo4&w=560&h=315]

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));
}

0 comments