public class activeplatform : MonoBehaviour
{
public bool on;
private void Start()
{
on = true;
StartCoroutine(corout());
StartCoroutine(corout2());
}
IEnumerator corout()
{
while (true)
{
yield return new WaitForSeconds(2);
if (on == true)
{
if (gameObject.CompareTag("deletegr"))
{
gameObject.SetActive(false);
on = false;
}
}
}
}
IEnumerator corout2()
{
while (true)
{
yield return new WaitForSeconds(2);
if (on == false)
{
if (gameObject.CompareTag("deletegr"))
{
gameObject.SetActive(true);
on = true;
}
}
}
}
}