When I click on the Button, the object turns around, but when I have to release the Button, the object is left to stand still, the problem is that I don’t know what to write in
TwoTaskOnClick () so that it doesn’t rotate?
Victorist Event Trigger, OnPointerDown (TaskOnClick), OnPointerUp (TwoTaskOnClick)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class mehanic : MonoBehaviour
{
public Transform detail1;
public Transform detail2;
public Transform detail3;
private bool click;
void Start()
{
}
public void TaskOnClick()
{
click = true;
}
public void TwoTaskOnClick()
{
}
void FixedUpdate()
{
if (click == true)
{
detail1.localRotation = Quaternion.RotateTowards(detail1.localRotation, Quaternion.Euler(new Vector3(30, 0, 0)), 20f * Time.deltaTime);
}
}