Код генерирует следующую ошибку:
input does not contain a definition for GetMouseButttonUp
Код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class carController : MonoBehaviour
{
float speed=0;
Vector2 startPos;
void Start(){ }
void Update()
{
if (Input.GetMouseButtonDown(0))
{
this.startPos=Input.mousePosition;
}
else if(Input.GetMouseButttonUp(0))
{
Vector2 endPos=Input.mousePosition;
float swipeLength=endPos.x-this.startPos.x;
this.speed=swipeLength/500.0f;
}
transform.Translate(this.speed,0,0);
this.speed*=0.98f;
}
}