- Home /
Itween suddenly stopped working entirely
The following code worked perfectly. It is the only code in its scene. Today I pushed through a new build of my game.
It no longer works. Why? using UnityEngine; using System.Collections;
public class SplashScreenManager : MonoBehaviour
{
Hashtable param;
Hashtable ScreenBrightenParam;
public float BrightnessChangeTime = 1.0f;
public float DarknessDelay = 3.0f;
public UISprite myspriterenderer;
public void Start()
{
param = new Hashtable();
param.Add("from", 0.2f);
param.Add("to", 1.0f);
param.Add("time", BrightnessChangeTime);
param.Add("onupdate", "ChangeTheValue");
ScreenBrightenParam = new Hashtable();
ScreenBrightenParam.Add("from", 1.0f);
ScreenBrightenParam.Add("to", 0.2f);
ScreenBrightenParam.Add("time", BrightnessChangeTime);
ScreenBrightenParam.Add("onupdate", "ChangeTheValue");
Brighten();
}
public void Darken()
{
iTween.ValueTo(gameObject, param);
Debug.Log("called");
Invoke("Loadlevel", BrightnessChangeTime);
}
public void Brighten()
{
iTween.ValueTo(gameObject, ScreenBrightenParam);
Debug.Log("called");
Invoke("Darken", DarknessDelay);
}
void Loadlevel()
{
Application.LoadLevel("StartMenu");
}
public void ChangeTheValue(float val)
{
Debug.Log(val);
myspriterenderer.color = new Color(myspriterenderer.color.r, myspriterenderer.color.g, myspriterenderer.color.b, val);
}
}
I appreciate your enthused response, but I did. The debugger takes me through iTween's internals, which isn't very helpful because 1) I don't understand them, and 2) they take forever to step through.
If I strip out the UISprite, and just keep the logging, I see values from 1.0 to 0.2, a pause, then values from 0.2 to 1.0, and finally an error because I don't have a level named "Start$$anonymous$$enu" in my project.
Seems to be working on my end. Are you seeing any errors in the console? $$anonymous$$aybe the UISprite is tripping things up?
Could you describe the problem more specifically? "No longer works" is pretty vague. What's not working? What should be happening that isn't?
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to import the object from server to unity 2 Answers
Material doesn't have a color property '_Color' 4 Answers
iTween : overload method hashtable not compatible with argument list hash 1 Answer
itween: firing oncomplete AFTER ONE LOOP 0 Answers