Сделал вращение,но оно почему-то выдаёт ошибку
Assets/Scripts/moving.cs(22,24): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected
вот код
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class moving : MonoBehaviour {
public GameObject obj;
private float speed = 5f,rotSpeed = 2f;
private Rigidbody2D rb;
private SpriteRenderer spr;
float rotation;
private void Awake(){
rb = GetComponent ();
spr = GetComponent ();
}
private void Run(){
rotation = rotSpeed * Input.GetAxis("Horizontal");
if (Input.GetAxis ("Horizontal") == 1f || Input.GetAxis("Horizontal") == -1f) {
rotation =+ rotSpeed;
}
transform.rotation = Quaternion (new Vector3 (transform.rotation, transform.rotation, rotation));
Vector3 direction = transform.up * Input.GetAxis ("Vertical");
transform.position = Vector3.MoveTowards (transform.position, transform.position + direction,speed * Time.deltaTime);
}
private void Update () {
Run ();
}
}