Answer the question
In order to leave comments, you need to log in
How to make control in Unity a character (error in the code)?
Hello! There was such a problem.
I am doing a project to test my capabilities, but I ran into a problem! Everything works in the code, but the problem is with the movement itself
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class forward : MonoBehaviour
{
public float speed = 100000;
GameObject Player;
// Start is called before the first frame update
void Start()
{
Debug.Log ("forward");
Player = (GameObject)this.gameObject;
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
Debug.Log ("forward");
Forward();
}
}
void Forward()
{
Player.transform.position += Player.transform.forward * speed * Time.deltaTime;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question