D
D
Denis Fedotov2020-06-15 23:06:06
Unity
Denis Fedotov, 2020-06-15 23:06:06

An embedded statement cannot be a declaration or a statement with an identifier. how to solve this error?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PleyerControl : MonoBehaviour {
  public float speed = 10f;
  private Rigidbody2D rb;

  void Start () {
    rb = GetComponent <Rigidbody2D> ();
  }
  
   void Update () {
    float moveX = Input.GetAxis ("Horizontal");
    rb.MovePosition (rb.position + Vector2.right * speed * moveX * Time.deltaTime);
    if (input.GetKeyDown (KeyCode.Space))
      rb AddForce = (Vector2.Up * 8000);
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-06-15
@GavriKos

rb AddForce = (Vector2.Up * 8000);

what is it? Right through the gap?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question