I don’t know how to deal with this error other than posting on this forum about it. I tried Google-ing it, but my search came back with no acceptable results. Thanks if you’ll help me.
When I change it to that I get an " ‘UnityEngine.Component’ does not contain a definition method ‘velocity’ acceptng a first arguement of type ‘UnityEngine.Component’ could be found (are you missing a using directive or an assembly reference?)" error on my “rigidbody.velocity” line.
Am I missing a using directive or an assembly reference?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
private Rigidbody myRigidbody;
void Start ()
{
myRigidbody = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
myRigidbody.velocity = new Vector3(moveHorizontal, 0.0f, moveVertical);
}
Also, post your code using code tags instead of images. It makes it easier for people to make changes to your code and show it to you rather than just throwing single command ideas at you.
I tried Joe-Censored’s code and now it’s saying “Unexpected symbol ‘Rigidbody’, expecting ‘class’, ‘delegate’, ‘enum’, ‘partial’ or ‘sruct’” for the line