Answer the question
In order to leave comments, you need to log in
How to make smooth movement through interactive buttons on android in unity3d?
I made buttons and hung scripts on them, but when I press the button, the machine only twitches once, how to execute the script while the button is pressed?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarControl : MonoBehaviour
{
public GameObject Car;
public float speed;
public void Start()
{
Car.GetComponent<Rigidbody2D>();
}
public void MoveRightDown()
{
transform.position += new Vector3(speed * Time.deltaTime, 0.0f, 0.0f);
Debug.Log("нажатие на кнопку вправо");
}
public void MoveRightUp()
{
Debug.Log("нажатие на кнопку вправо");
}
public void MoveLeftUp()
{
transform.position -= new Vector3(speed * Time.deltaTime, 0.0f, 0.0f);
Debug.Log("нажатие на кнопку влево");
}
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