- Home /
Sphere wont load the script
I am trying to learn unity but whenever i assign a c# code to an object it says link:this
This problem doesn't happen with JS could someone help me please?!
using UnityEngine; using System.Collections;
public class PlayerController : $$anonymous$$onoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}
this script is from the learn unity site https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial/moving-player?playlist=17141
In C# the name of the file must match the class name in the file, so the file must be "PlayerController.cs". Is that the case?
Your answer
Follow this Question
Related Questions
orienting player in one direction 1 Answer
Have an object only visible when input is held down 1 Answer
Need help with dialogue system script 0 Answers
Is there a reason why Unity would be able to read one variable in a script and not another? 1 Answer
After exporting my project from my PC to my laptop the physics of my game work differently. 1 Answer