- Home /
cannot be used with a left hand side of type 'float' and a right hand side of type 'Object'
Assets/Scripts/aniSprite.js(10,32): BCE0051: Operator '>' cannot be used with a left hand side of type 'float' and a right hand side of type 'Object'.
private var myTime :float = 0; private var isPlay = true; function aniSprite (columnSize,rowSize,colFrameStart,rowFrameStart,totalFrames,framePerSecond,totalTime){ myTime += Time.deltaTime;
if (totalTime!=0 && myTime>totalTime)----------------error--------------how to fix
{
isPlay = false;
myTime = 0;
return isPlay;
}
var index : int = Time.time * framesPerSecond;
index = index % totalFrames;
var size = Vector2 (1.0 / columnSize, 1.0 / rowSize);
var u : int = index % columnSize;
var v : int = index / columnSize;
var offset = Vector2 ((u + colFrameStart) * size.x, (1.0 - size.y) - (v + rowFrameStart) * size.y);
renderer.material.mainTextureOffset = offset;
renderer.material.mainTextureScale = size;
return true;
}
Comment
Answer by MarkFinn · Nov 09, 2012 at 08:44 AM
Define your parameter types in your function definition.
function aniSprite , columnSize, rowSize,colFrameStart,rowFrameStart,totalFrames,framePerSecond,totalTime:float)
I've changed the totalTime parameter above, but you'll need to do all the others.
Your answer
![](https://koobas.hobune.stream/wayback/20220613083600im_/https://answers.unity.com/themes/thub/images/avi.jpg)