Hi I am getting an error i.e CS1022
Here is the script can you tell what is wrong with it
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
{
}
public class Playercontroller: MonoBehaviour
{
private Rigidbody rb;
private float movementX;
private float movementY;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Onmove(InputValue movementValue)
{
Vector2 movementVector = movementValue.Get<Vector2>();
movementX = movementVector.X;
movementY = movementVector.Y;
}
void FixedUpdate()
{
Vector3 movement = new Vector3(movementX, 0.0f, movementY);
rb.AddForce(movement);
}
}
Yeah man, you have open/close brackets above your class just below your using statements
Now what should I do
I tried to delete them but it makes more errors
I tried to delete them but it makes more errors
It gives the error CS1061
Here is the script after change
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
using UnityEngine.InputSystem;
public class Playercontroller : MonoBehaviour
{
private Rigidbody rb;
private float movementX;
private float movementY;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Onmove(InputValue movementValue)
{
Vector2 movementVector = movementValue.Get<Vector2>();
movementX = movementVector.X;
movementY = movementVector.Y;
}
void FixedUpdate()
{
Vector3 movement = new Vector3(movementX, 0.0f, movementY);
rb.AddForce(movement);
}
private string GetDebuggerDisplay()
{
return ToString();
}
}
What errors do you get after taking them out?
It gives the error CS1061
Here is the script
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
using UnityEngine.InputSystem;
public class Playercontroller : MonoBehaviour
{
private Rigidbody rb;
private float movementX;
private float movementY;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Onmove(InputValue movementValue)
{
Vector2 movementVector = movementValue.Get<Vector2>();
movementX = movementVector.X;
movementY = movementVector.Y;
}
void FixedUpdate()
{
Vector3 movement = new Vector3(movementX, 0.0f, movementY);
rb.AddForce(movement);
}
private string GetDebuggerDisplay()
{
return ToString();
}
}
That error means you’re trying to use a method that doesn’t exist, double click the error in your console, it should take you to the line that it’s on, which line is it?
I did something and the error was solved
Thanks,Thanks,Thanks for your kind advice