`UnityEngine.UI.BaseVertexEffect' is obsolete: `Use BaseMeshEffect instead'
using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI;
[AddComponentMenu( "UI/Effects/Gradient" )] public class Gradient : BaseVertexEffect //The error here { [SerializeField] private Color32 topColor = Color.white; [SerializeField] private Color32 bottomColor = Color.black;
public override void ModifyVertices( List<UIVertex> vertexList )
{
if( !IsActive() )
{
return;
}
int count = vertexList.Count;
float bottomY = vertexList[0].position.y;
float topY = vertexList[0].position.y;
for( int i = 1; i < count; i++ )
{
float y = vertexList[i].position.y;
if( y > topY )
{
topY = y;
}
else if( y < bottomY )
{
bottomY = y;
}
}
float uiElementHeight = topY - bottomY;
for( int i = 0; i < count; i++ )
{
UIVertex uiVertex = vertexList[i];
uiVertex.color = Color32.Lerp( bottomColor, topColor, ( uiVertex.position.y - bottomY ) / uiElementHeight );
vertexList[i] = uiVertex;
}
}
}
Answer by fcomert · May 22, 2017 at 10:53 AM
http://prntscr.com/faowbr![alt text][1]
[1]: https://image.prntscr.com/image/2e02493b405b42aca3407e3dda0ccb38.png
Your answer
Follow this Question
Related Questions
Getting Facebook Invite Problem 0 Answers
Event System SetSelectedGameObject Error, but code still runs fine. 2 Answers
I Have an C# error and I can't fix it @username 1 Answer
Error upon rebooting Unity - "Associated script cannot be loaded" How can I resolve this? 2 Answers
Object reference not set to instance of an object? 0 Answers