- Home /
 
CharacterController not found the GameObject
Hi, How can I solution this?
MissingComponentException: There is no 'CharacterController' attached to the "Player" game object, but a script is trying to access it. You probably need to add a CharacterController to the game object "Player". Or your script needs to check if the component is attached before using it. UnityEngine.CharacterController.Move (UnityEngine.Vector3 motion) <0x38f54800 + 0x0005a> in :0 PlayerController.FixedUpdate () (at Assets/Scripts/PlayerController.cs:25)
Blockquote using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerController : MonoBehaviour {
 public float movimientoX;
 public float movimientoY;
 public CharacterController player;
 // Start is called before the first frame update
 void Start()
 {
     player = GetComponent<CharacterController>();
     
 }
 // Update is called once per frame
 void Update()
 {
     movimientoX = Input.GetAxis("JoystickIzqX");
     movimientoY = Input.GetAxis("JoystickIzqY");
 }
 private void FixedUpdate()
 {
     player.Move(new Vector3(movimientoX, 0.0f, movimientoY));
 }
 
               }
Answer by HappiiGamer · Oct 16, 2019 at 01:18 PM
The error says it, you need to have a CharacterController sitting in your PlayerController GameObject. For now, you only have two components: Transform and PlayerController.
Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How can i rotate my character smooth using keys ? 0 Answers
Distribute terrain in zones 3 Answers
SetDestination function error 0 Answers
what is wrong whis this? 1 Answer
