So I need help with a way to pass castBarCoords by reference in order to change it’s position on the canvas.Any help or ideas would be appreciate
Update(){
...
if (player.casting==true) {
MoveCastBar(castBarCoords,castStartPos,castEndPos,player.castTime);
}
...}
private IEnumerator MoveCastBar(ref RectTransform castBarCoords, Vector3 start, Vector3 end,float castTime){
float timeLeft = Time.deltaTime;
float speed = 1.0f / castTime;
float progress = 0.0f;
while (progress<=1.0) {
castBarCoords.position = Vector3.Lerp(castStartPos, castEndPos, progress);
progress+=speed*Time.deltaTime;
timeLeft+=Time.deltaTime;
yield return null;
}
castBarCoords.position = castEndPos;
}