Would be great to receive help on using Color.Lerp with the Lightweight Render Pipeline. Using it with the Standard Shader seems to work fine but unfortunately not the same with the Lightweight Render Pipeline Lit Shader. I am trying to create a material for a number of objects in such a way that the objects in front differ in colour from the one’s at the back and in between there is some kind of blend in the colours.
Renderer obstacleRenderer = newObstacle.GetComponent<Renderer>(); Material obstacleMaterial = new Material(obstacleRenderer.sharedMaterial); float colourPercent = randomCoord.y / (float)currentMap.mapSize.y; obstacleMaterial.color = Color.Lerp(currentMap.forgroundColour, currentMap.backgroundColour, colourPercent); obstacleRenderer.sharedMaterial = obstacleMaterial;
The randomCoord variable is in
reference to a method for picking a
random tile of quads in the scene to
put the obstacles.
newObstacle variable is a transform
used for instantiating obstacles.
currentMap.backgroundColour are public
colour variables for changing the
colour in the inspector of the editor.
Any help would be really useful.