i want the wheel staring spin only if i click it on a button !!! (i have script)
hey everyone !! i made a wheel spinner game, it's work fine but the wheel starting spin automatically when i start the scene . i want the wheel staring spin only if i click it on a button, how i can do that !! (i know that should to add button to Hierarchy & drop the script to the On Click in Inspector to button. i literally do that but no function showing up ). more info : i have also another button for re-spinning attached with script name 'spinner' with function called 'Reset()' {this button is working}.
you will find the 'spinner' script below
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class spinner : MonoBehaviour
{
public float reducer;
public float multiplier = 1;
bool round1 = false;
public bool isStoped = false;
public void Reset()
{
multiplier = 1;
reducer = Random.Range(0.01f, 0.5f);
round1 = false;
isStoped = false;
}
public void Start()
{
reducer = Random.Range(0.01f, 0.5f);
}
// Update is called once per frameQ
void Update()
{
if (multiplier > 0)
{
transform.Rotate(Vector3.forward, 1 * multiplier);
}
else
{
isStoped = true;
}
if (multiplier < 20 && !round1)
{
multiplier += 0.1f;
}
else
{
round1 = true;
}
if (round1 && multiplier > 0)
{
multiplier -= reducer;
}
}
}
thank u so much
Your answer
Follow this Question
Related Questions
unable to attack enemy objects? 1 Answer
Add object using other scene,Change something in scene from the menu 2 Answers
Problem with my script 0 Answers
Correctly smooth crouch script? 2 Answers
ClientRpc not functioning 0 Answers