void OnEnable() { if (gameManager == null) { gameManager = GameObject.FindWithTag("GameManager").GetComponent <GameSceneManager> (); } if (paddle == null) { paddle = GameObject.FindWithTag("Paddle"); } if (timer == null) { GameObject go = GameObject.FindWithTag("Timer"); if (go != null) { timer = go.GetComponent <Timer> (); } } if (ballControl == null) { ballControl = GameObject.FindWithTag("BallController").GetComponent <BallController>(); } gameManager.OnGameStart += Play; gameManager.OnGameEnd += EndGame; gameManager.OnGamePause += Pause; gameManager.OnGameResume += Resume; gameManager.OnPushBall += PushBall; gameManager.OnGameRevive += Revive; gameManager.OnDeathBeforeAd += DeathBeforeAd; rb = GetComponent <Rigidbody2D>(); sr = GetComponent <SpriteRenderer> (); ballControl.AddBall(this.gameObject); sr.enabled = true; }