Hello friends;
This is my codes :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
Rigidbody2D body2D;
public float playerSpeed;
void Start()
{
body2D = GetComponent();
}
void FixedUpdate()
{
float h = Input.Getaxis(“Horizontal”);
body2D.velocity = new Vector2(h * playerSpeed, 0);
}
}
this is error:
Assets/Player.cs(21,25): error CS0117: UnityEngine.Input' does not contain a definition for Getaxis’
Its GetAxis note the capital A in Axis. Make sure you look at the docs if you ever have an issue. Theres plenty of good information on there and will help you to notice things like this.
The method is called “GetAxis” not “GetAxies”, so it´s “Input.GetAxis”.
Stuff like that is described in the docu where you can find all methods of a class and how they will be written (Unity - Scripting API: Input), using the code complition of the IDE helps too, for problems like that.
Please use code tags to post code in the forum, to make it easier for all to read the code.