my script doesn’t work in Unity I don’t know what my error is, but this message appears " the Associated script can not be Loaded, "the script is this

Asked

Viewed 231 times

0

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
        public class Player : MonoBehaviour 
    {
        public float Speed;
        public float JumpForce;
    
        private Rigidbody2D rig;
    
        // Use this for in

itialization
    void Start () {
        rig = GetComponent<Rigidbody2D>();
    }
    
    // Update is called once per frame
    void Update () {

        Move();
        Jump();

    }

    void Move () {
        Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
        transform.position += movement * Time.deltaTime * Speed;
    }

    void Jump () {
        if(Input.GetButtonDown("Jump")) {
            rig.AddForce(new Vector2(0f, JumpForce), ForceMode2D.Impulse);
            }
        }
    }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.