void addScorebubble(int score) { if (score > 0) { GameObject GOScore = Instantiate(Resources.Load("Gameplay/ScoreAnimation") as GameObject); GOScore.transform.SetParent(transform.parent, false); GOScore.transform.localPosition = GOScore.transform.localPosition + transform.localPosition; UIScoreAnimationController c = GOScore.GetComponent <UIScoreAnimationController>(); c.gameObject.AddComponent <DestroyAfter>().After = 1.4f; c.Play(score); } }
void addScorebubble(Transform parent, int score) { GameObject GOScore = Instantiate(Resources.Load("Gameplay/ScoreAnimation") as GameObject); GOScore.transform.SetParent(parent, false); if (transform != parent) { GOScore.transform.position = transform.position; } UIScoreAnimationController c = GOScore.GetComponent <UIScoreAnimationController>(); c.gameObject.AddComponent <DestroyAfter>().After = 1.4f; c.Play(score); }
public void addScorebubble(Transform parent, int score) { if (GOScoreBubble != null) { return; } GOScoreBubble = Instantiate(Resources.Load("Gameplay/ScoreAnimation") as GameObject); GOScoreBubble.transform.SetParent(parent, false); if (transform != parent) { GOScoreBubble.transform.position += transform.position; } UIScoreAnimationController c = GOScoreBubble.GetComponent <UIScoreAnimationController>(); c.gameObject.AddComponent <DestroyAfter>().After = 1.4f; c.Play(score); //Debug.Log (new System.Exception ().StackTrace); }