Проблема в теме. Вот скрипт:
Код
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerControl : MonoBehaviour {
Rigidbody2D Body;
public float Speed=5f;
public float Jump = 500f;
void Start()
{
Body = gameObject.GetComponent<Rigidbody2D>();
}
private void Update()
{
}
private void FixedUpdate()
{
Body.velocity = new Vector2(1 * Speed, Body.transform.position.y);
if (Input.GetKeyDown(KeyCode.Space))
{
Body.AddForce(new Vector2(Body.transform.position.x, transform.position.y * Jump));
// Body.velocity = new Vector2(0, Jump);
Debug.Log("Jump!");
}
}
}