【发布时间】:2018-02-11 17:22:32
【问题描述】:
我在尝试进入游戏模式时遇到了统一代码问题 它说
Assets/game/Scripts/Effects/Gradient.cs(14,26): error CS0115: `Gradient.ModifyVertices(System.Collections.Generic.List<UnityEngine.UIVertex>)' is marked as an override but no suitable method found to override
Gradient.cs 看起来像这样
using System.Collections.Generic;
using UnityEngine.UI;
[AddComponentMenu( "UI/Effects/Gradient" )]
public class Gradient : BaseMeshEffect
{
[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;
}
}
}
谁能帮我解决这个问题,我是团结的初学者,一个多月以来我一直在寻找解决方案。 PS:我正在使用统一 2017.3
【问题讨论】: