- Home /
how would i enable button every X amount of points
hey guy so i have a piece of code i wrote to allow my "special" button to activate once over a certain amount of point thing is once its activated you can keep using it and i want it to activate accept a press then deactivate till the next, lets say 1000 points is this possible can some one what can be used to portray this?
here is the function i want activated every 1000 pts and it should deactivate once pressed(its tied to a guitexture button on touch screen):
IEnumerator SloMo()
{
if(Time.timeScale == 1.0f)
{
Time.timeScale = newTimeScale;
Time.fixedDeltaTime = Time.fixedDeltaTime/slowFactor;
Time.maximumDeltaTime = Time.maximumDeltaTime/slowFactor;
}
yield return new WaitForSeconds(0.5f);
if(Time.timeScale == newTimeScale)
{
Time.timeScale = 1.0f;
Time.fixedDeltaTime = Time.fixedDeltaTime*slowFactor;
Time.maximumDeltaTime = Time.maximumDeltaTime*slowFactor;
special.enabled = false;
}
}
How is your button being drawn? Is it a GUI.Button() call? If so, enabling/disabling the button is ultimately a question of whether or not you make that call. Is it a GameObject? If so, you could call SetActive() on it.
yea its an actual gameobject (Gameobject --> Create other --> GUI Texture
Answer by Computerkid23 · Nov 05, 2013 at 08:41 PM
ahhh ok i dont know if this is the best way but i figured it out
public GUITexture SlowMO;
void Start()
{
SlowMo.enable = false;
}
for some reason .SetActive wasnt working for me
thanks guys
Answer by Starwalker · Nov 05, 2013 at 07:36 PM
special.SetActive() = false;
This is what i used before but i gives me this error:
The left-hand side of an assignment must be a variable, a property or indexer
Your answer
Follow this Question
Related Questions
Android File-io? 1 Answer
Simple Unity3d Facebook Integration? 1 Answer
How to run unity app like a "live wallpaper" on android? 0 Answers
Android Native Plugin (NOT WORKING) 1 Answer