I’ve made it through a ton of tutorials(Unity’s community is awesome!) but I’m stuck on something that feels stupid obvious and basic. I’m starting the tutorials on Catlike coding and made the clock. I wanted a simple quad to show up with a moon or a sun based on AM/PM, and here’s the code:
using UnityEngine;
using System.Collections;
using System;
public class CheckTimePM : MonoBehaviour {
void FixedUpdate ()
{
if (DateTime.Now.ToString("tt") == "AM")
{
gameObject.SetActive (false);
}
else if (DateTime.Now.ToString("tt") == "PM")
{
gameObject.SetActive (true);
}
}
}
And there’s an almost identical script attached to the AM object(public class CheckTimeAM), with the setactives reversed.
And if I open the app and it’s PM it looks like this:

AM looks like this:

It works! BUT if I have the app open already and change AM to PM or vice versa, it deactivates the active quad but does not activate the deactivated one. Like so:

If you see what’s going on in my code, let me know! I think I might have some simple fundamental misunderstanding of how SetActive works? Do I need to instantiate a prefab of the quads to do this? If so, why?
Thanks so much for your time folks! I tried searching for a reason for this but couldn’t find one, sorry if I missed an obvious resource.