#i created a cube called player and a

1 messages · Page 1 of 1 (latest)

somber sedge
#

could you provide more information?

#

did you give the cube the script?

blazing drift
#

my goal is to make this cube moves hirzontaly and verticaly

#

iam a beginner

somber sedge
#

The name of the cube doesent really matter. If you want the script to affect the player you need to attach the player with the script

#

no worries I was also a beginner a few years ago

#

go to your cube -> on the properties pannel click add a component

#

then you can add your script (or drag and drop it there)

blazing drift
#

ok let me try that

blazing drift
somber sedge
#

run the game does it work?

blazing drift
#

wait

#

still the same problem : The referenced script (Unknown) on this Behaviour is missing!

somber sedge
#

could you send a picture of the cube and the components

blazing drift
#

sure

#

wait

#

after i run the project the script file that i added to the cube show an error .. i added the script file only one time i do not know how did these two files come

#

@somber sedge

somber sedge
#

show me a picture of it in the editor

blazing drift
#

the cube or the script file ?

somber sedge
somber sedge
#

send a picture of the cube with its properties

#

without running the game (so in editor)

blazing drift
#

this is the project

somber sedge
#

ok yes but show me the properties underneath the box collider,

#

ok click ont he 3 arrows, and remove both the scripts

blazing drift
#

where are them

somber sedge
#

then drag and drop the player script in the project folder onto the player

blazing drift
#

from here or in the unity app ?

somber sedge
#

in the unity app

blazing drift
#

i did

#

same problem :/

somber sedge
#

paste the code of the script

blazing drift
# somber sedge paste the code of the script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour
{
     Rigidbody rb;
    // Start is called before the first frame update
    void Start()
    {
         rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");
        Vector3 movement = new Vector3(h, 0, v);
        rb.AddForce(movement * 10); 
    }
}
somber sedge
#

ok remove all the scripts from the player components, create a new empty script, does it show up normally or still give you that same error

#

im not sure why youre getting this error

blazing drift
#

it shows the same problem

#

at first it was not showing any errors

#

at first a created a script file and add this in it : Debug.Write("hello world");

#

and it was working

somber sedge
#

So it’s still broken? Even with an empty script?

blazing drift
#

the script has the main code .. this code :

#

and yes

#

it still broken

#

might i can change the file name ?

#

might work

#

such as " playerr "

#

instead of " player "

#

bro

somber sedge
#

Call it PlayerMovement

blazing drift
#

even without the any script files

#

it shows the error

somber sedge
#

Yeah I don’t know 🤷‍♂️

#

Maybe someone more experienced can help

blazing drift
#

ok