using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerController : MonoBehaviour {
public float VertImp;
Rigidbody2D rb;
if (grounted)
{
rb.AddForce(Vector2.up * strenght);
}
void Start () {
rb = GetComponent<Rigidbody2D> ();
}
void FixedUpdate () {
if (Input.tochCount > 0) {
rb.AddForce (new Vector2 (0, VertImp), ForceMode2D.Impulse);
foreach(Touch t in Input.touches)
}
}
}
мой код стал выглядеть вот так, а ошибки, тут и говорить нечего.
**Assets/script/playerController.cs(10,3): error CS1519: Unexpected symbol `if' in class, struct, or interface member declaration
Assets/script/playerController.cs(10,14): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration**
error CS9010: Primary constructor body is not allowed
Assets/script/playerController.cs(23,2): error CS1525: Unexpected symbol `}'
ledoed:
ООО спасибо! Это точно! ledoed:
Зделал всё по инструкции с интернета + твои советы, исправил все ошибки, но выдало последнюю ошибку The type or namespace name `RigitBody2D' could not be found. Are you missing an assembly reference? Не знаю как исправить! если хочешь вот код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerController : MonoBehaviour {
public float VertImp;
RigidBody2D rb;
void Start () {
rb = GetComponent<RigitBody2D> ();
}
void Update () {
if (Input.toches ()) {
RigitBody.AddForce (new Vector2 (0, VertImp), ForceMode2D.impulse);
}
}
}
Отредактирован Uber
» Unity / Прыжок
**Assets/script/playerController.cs(10,3): error CS1519: Unexpected symbol `if' in class, struct, or interface member declaration
Assets/script/playerController.cs(10,14): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration**
error CS9010: Primary constructor body is not allowed
Assets/script/playerController.cs(23,2): error CS1525: Unexpected symbol `}'
Отредактирован N7 Molot
» Unity / Прыжок
ООО спасибо! Это точно!
ledoed:
Зделал всё по инструкции с интернета + твои советы, исправил все ошибки, но выдало последнюю ошибку The type or namespace name `RigitBody2D' could not be found. Are you missing an assembly reference? Не знаю как исправить! если хочешь вот код:
Я кароч немного исправил, но ошибка тут!