How can I change the object material automatically without clicking on it.The object material should change based on the timing
Unity has a Time class that can tell you how time is changing. There is also a MeshRenderer class that gives you access to the materials a mesh contains.