Имея некоторые проблемы с Unity со сценариями. Основная проблема заключается в том, что я пытаюсь плеер ходить и идель в мой плеер сценария ошибки являются:. ошибки синтаксического анализа и неожиданные символыАктивы/скрипты/Player.cs (40,36): ошибка CS1519: Неожиданный символ `('в объявлении класса, структуры или интерфейса
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public float speed = 10f;
public Vector2 maxVelocity = new Vector2(3,5);
public bool standing;
public float jump = 15f;
public float airSpeedMultipler = .3f;
private Animator animator;
void start(){
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
var forceX = 0f;
var forceY = 0f;
var absVelX = Mathf.Abs (GetComponent<Rigidbody2D>().velocity.x);
var absVelY = Mathf.Abs (GetComponent<Rigidbody2D>().velocity.y);
if (absVelY < .2f) {
standing = true;
} else {
standing = false;
}
if (Input.GetKey ("right")) {
if (absVelX < maxVelocity.x)
forceX = standing ? speed : (speed * airSpeedMultipler);
transform.localScale = new Vector3 (1, 1, 1);
}
animator.SetInteger("Animstate", 1);
} else {
animator.SetInteger("Animstate",0);
}
} else if (Input.GetKey ("left")) {
if (absVelX < maxVelocity.x)
forceX = standing ? -speed : (-speed * airSpeedMultipler);
transform.localScale = new Vector3(-1, 1, 1);
}
if (Input.GetKey ("up")) {
if (absVelY < maxVelocity.y)
forceY = jump;
}
GetComponent<Rigidbody2D>().AddForce(new Vector2 (forceX, forceY));
}
}
Ваши фигурные скобки '{' должны соответствовать 1-к-1. отступы пройдут долгий путь для вас. – Dan