我在LineRenderer SetWidth上收到警告,它已过时我应该如何解决? [英] I'm getting warning on LineRenderer SetWidth that it's obsolete how should i fix it?
问题描述
lineRenderer.SetWidth(startWidth, endWidth);
lineRenderer.SetVertexCount(linePoints.Count);
在两行上都出现相同的警告:
On both lines same warning:
'LineRenderer.SetVertexCount(int)'已过时:'SetVertexCount已被弃用.请改用numPositions属性."
'LineRenderer.SetVertexCount(int)' is obsolete: 'SetVertexCount has been deprecated. Please use the numPositions property instead.'
还有
'LineRenderer.SetWidth(float,float)'已过时:'SetWidth已弃用.请改用startWidth,endWidth或widthCurve属性.
'LineRenderer.SetWidth(float, float)' is obsolete: 'SetWidth has been deprecated. Please use the startWidth, endWidth, or widthCurve properties instead.'
然后我尝试了这个:
lineRenderer.startWidth(startWidth, endWidth);
但是在startWidth属性上却出现了错误:
But then getting error on startWidth property:
'LineRenderer.startWidth'不能像方法一样使用.
'LineRenderer.startWidth' cannot be used like a method.
推荐答案
某些LineRenderer
函数已更改为属性,并已重命名以避免混淆.您设置属性时不能将其称为函数.对于lineRenderer.SetVertexCount
,您可以使用lineRenderer.positionCount
进行设置.
Some of the LineRenderer
functions has been changed to properties and also renamed to avoid confusion. You set properties not call it as a function. For lineRenderer.SetVertexCount
, you use lineRenderer.positionCount
to set that.
lineRenderer.startWidth = startWidth;
lineRenderer.endWidth = endWidth;
lineRenderer.positionCount = linePoints.Count;
这篇关于我在LineRenderer SetWidth上收到警告,它已过时我应该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!