Search code examples
c#unity-game-engineactivationgameobject

C# - SetActive dont work?


can someone tells me why my gameObject doesn't activate again?

Thanks.

C# Code

using UnityEngine;
using System.Collections;

public class SlowerPowerUP : MonoBehaviour {

    // Use this for initialization
    void Start () {
    }

    // Update is called once per frame
    void Update () {
        if (BirdMovement.CountFS > 300) {
            gameObject.SetActive(true);
        } 
        else {
            gameObject.SetActive(false);
        }
    }
}

Solution

  • Deactivated objects are not receiving unity events (Update, FixedUpdate etc). So gameObject.SetActive(true); will not be called