Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

PLEASE HELP WHAT DOES THIS ERROR MEAN????

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.SceneManagement;


public class Palyer : MonoBehaviour

{

  // Start is called before the first frame update

  void Start()

  {

    Rigid = GetComponent<Rigidbody>();

  }


  // Update is called once per frame

  void Update()

  {

    Time.timeScale += Time.fixedDeltaTime * 0.01f; 

    transform.rotation *= Quaternion.Euler(0,0, Time.deltaTime * 7f);

    rigid.velocity += transform.rotation * (Input.GetAxisRaw("Horizontal") * Vector3.right * 10f) * Time.deltaTime;

    rigid.velocity += transform.rotation * (Input.GetAxisRaw("Vertical") * Vector3.up * 10f) * Time.deltaTime;



  }

  private void OnCollisionEnter(Collision collision)

  {

    Time.timeScene = 1f;

    SceneManager.LoadScene(SceneManager.GetActiveScene().name);

  }

}

Assets\Palyer.cs(11,9): error CS0103: The name 'Rigid' does not exist in the current context

Assets\Palyer.cs(19,9): error CS0103: The name 'rigid' does not exist in the current context

Assets\Palyer.cs(20,9): error CS0103: The name 'rigid' does not exist in the current context

Assets\Palyer.cs(26,14): error CS0117: 'Time' does not contain a definition for 'timeScene'

Best Answer

  • MouledouxMouledoux Member
    Accepted Answer

    Nope, check the video at 5:01, you can see at the top he has declared the Rigidbody, and all the spelling is correct.

Answers

  • MouledouxMouledoux Member

    the first 3 mean you haven't declared the variable, and then spelled it wrong twice.

    the second one means that the object is not defined.

  • JOHNKAWAJOHNKAWA Member

    Can u tell me how to fix the errors? I am new to unity and I am very curious about this software?

  • MouledouxMouledoux Member

    Yes, the first one is because you never made the variable "Rigid". You need to declare your variables first before you set them. Outside of the function, make a Rigidbody variable, and name it '"rigid"

    The next 2, are for the same reason, but you also spelled "Rigid" as "rigid" with a lower case. Typically variables start with lowercase, and uppercase is reserved for functions.

    The last one is because you misspelled "timeScale" as "timeScene". Unless timeScene is a thing, but I've never heard of it.

  • JOHNKAWAJOHNKAWA Member

    https://youtu.be/qHcmdM78tCM

    Could you check this guy's video coz he wrote the same thing and it works for him?!? Especially the rigidbody part which he didn't add at all!? Or I maybe wrong but could you just check it once please and thanks a lot!!!!!

  • JOHNKAWAJOHNKAWA Member

    Oh I see thank you so much

  • ABOABO Member

    If your problem has been solved, please mark your question as answered

Sign In or Register to comment.