1
NGUI 3 Support / Crashing Unity when calling a method that uses TweenAlpha
« on: January 05, 2014, 08:20:49 PM »
Crashing Unity when calling a method that uses TweenAlpha
I am including my example script, I am unsure why this would cause Unity to hard crash.
If I take out the call to Fade from within TestMe() Unity is fine, if I have the call in as shown above, it hard crashes Unity.
I am hoping I am doing something wrong, but it not, I figured you may want to know about it.
I am including my example script, I am unsure why this would cause Unity to hard crash.
If I take out the call to Fade from within TestMe() Unity is fine, if I have the call in as shown above, it hard crashes Unity.
I am hoping I am doing something wrong, but it not, I figured you may want to know about it.
- using UnityEngine;
- using System.Collections;
- public class ActivePlayerHUDController : MonoBehaviour {
- public UILabel cardLabel;
- public UISprite card1;
- public UISprite card2;
- public UISprite card3;
- public UISprite card4;
- public UISprite card5;
- private TweenAlpha activePlayerHUDAlpha;
- private bool isVisible;
- void Start() {
- activePlayerHUDAlpha = this.GetComponent<TweenAlpha>();
- Fade(activePlayerHUDAlpha, 0.0f, 1.0f, 10.0f, "TestMe");
- }
- void Update() {
- }
- void Fade(TweenAlpha alpha, float fromValue, float toValue, float duration, string methodAsString) {
- alpha.from = fromValue;
- alpha.to = toValue;
- alpha.duration = duration;
- if (methodAsString != "") {
- alpha.callWhenFinished = methodAsString;
- }
- alpha.style = UITweener.Style.Once;
- alpha.eventReceiver = gameObject;
- alpha.Play(true);
- }
- void TestMe() {
- Fade(activePlayerHUDAlpha, 1.0f, 0.0f, 3.0f, "");
- }
- }