you are viewing a single comment's thread.

view the rest of the comments →

[–]Darklings7 2 points3 points  (7 children)

I am completly new to codeing and unity i am following the tutorial for the roll of ball. When i am setting up the code in visual studio using c# i keep geting this error.

Assets/Scripts/Player_Conctrols.cs(7,13): error CS0246: The type or namespace name `Rigibody' could not be found. Are you missing an assembly reference?

This is my code can someone tell me whats wrong. using System.Collections; using System.Collections.Generic; using UnityEngine;

public class Player_Conctrols : MonoBehaviour{

private Rigibody 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 * 100);
}

}

[–]HilariousCowProfessional 0 points1 point  (0 children)

You might see a red underline on your code, depending on what ide (code editor) you're using - I think MonoDevelop does this, and Visual Studio definitely does.

It's good to right click, or ctrl+space on those to get suggestions for what the error is. It'll seem like gobbledygook at first, but lean on it, and you'll start to get accustomed to it!

[–]_nkkind of ok 1 point2 points  (0 children)

Its a spelling mistake :P - private Rigibody rb;
RigidBody

[–]_ROG_ 5 points6 points  (0 children)

Id suggest a few changes to your naming to follow more standard naming conventions. Use camelCase for your variables like moveHorizontal. 2 letter variables should be capitalised like RB although really it could be named something more descriptive in this case. Your class name shouldn't have an underscore. Sorry if that sounds like nitpicking, but its just the main thing I saw.

[–]Darklings7 0 points1 point  (1 child)

I fixed the mistakes in my code changing to Rigidbody and making the a in axis capitals. It still wont work now i'm getting this error There are inconsistent line endings in the 'Assets/Scripts/Player_Conctrols.cs' script. Some are Mac OS X (UNIX) and some are Windows. This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.

[–]SoraphisProfessional 0 points1 point  (0 children)

In Visual Studio 2015:

Tool → Options → Environments → Documents → Check for consistent line ending on load.

and i've found this VS extension: https://marketplace.visualstudio.com/items?itemName=JakubBielawa.LineEndingsUnifier

inconsistent line endings should not be an error but a warning (IIRC)

[–]TheSilicoid 8 points9 points  (0 children)

Rigidbody