How do I prevent fungal growth on my pebbles and cave in my betta tank? I just cleaned out the tank because there was black fungus growing on the pebbles and green fungus growing on the cave. I only have one betta fish living in it. The tank is 1 gallon and has a filter and light. Also, whenever I change it's water, I keep the tank in the garage for 1 hour so the water isn't too cold for my betta.
As I mentioned in the comments, this most likely isn't a case of fungal growth. Especially if the underground isn't living material (i.e. rocks, stones, or sand) and considering the colors you describe, this sounds very much like typical algae found in both new and healthy aquariums.
One important thing first: Algae aren't bad, generally speaking. While there are algae that can even be poisonous, having some algae in your tank is actually a good thing and the ones you typically encounter won't harm your fish either (if they're not taking over the tank). Instead, they'll provide habitat for useful bacteria and other often overlooked aquarium inhabitants, that will help you keep your water clean and your fish(es) healthy. You could consider patches of algae some kind of natural filter, that will reduce ammonia, nitrite, and nitrate in the water, although it's typically not effective enough for most tanks.
The brown or almost black "fungus" you're describing sounds a lot like brown algae (phaeophyta), which are very typical for new aquariums. They should disappear over a few weeks. Some leftovers might stay though. But just leave them. If you clean everything and start over, you essentially provide these a fresh start as well.
If you take a look at the picture above, you'll notice a few dark spots on the right side of the stones. That's pretty much all that is left of the brown algae that once covered like 90% of that stone. Now there are just some small patches of green algae left. Don't consider such pebbles or stones dirty. That's natural growth and nothing you should try to prevent. Personally I prefer stones covered in algae.
The green algae (chlorophyta) are a typical sign for direct sunlight and/or too much nutrients in the water. Our aquarium has some of these as well, but I usually just "trim" them. They provide a nice contrast, I consider them looking great when waving with the water current, and they provide cover for small snails, shrimps, etc. As with many things: None is probably as bad as having too much.
Sorry that I can't provide better pictures right now, my mobile phone has quite some trouble focusing on the moving plants and algae parts. It's really hard to see, but these algae grow between some branches of other plants.
In case the algae are covering the glass, just clean it with a soft pad or special rubber pad (sold in stores). As an alternative, buy a nerite snail/racing snail. These snails eat algae all day long, but they can't procreate in freshwater.
Whatever you do, don't grab some anti-algae chemicals. They're really not necessary and also usually not healthy for fishes or water quality overall.