- Home /
Question by
Trild123787898 · Jan 20, 2020 at 07:04 PM ·
transformbuttonscript.
problem when clicking on Button
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);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612221843im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
object rotation with rigidbody component 1 Answer
Animation script help light problem 0 Answers