Summary
The past month, my time working on these passion projects was drastically cut due to the influx of freelancing work. ‘Tis the season, after all! Despite this, I managed to progress through some pretty big issues that popped up when I plowed through the learning. Issues such as pink textures, broken UI, and buttons that wouldn’t function the way I wanted them to.
Before I get into it, I would like to share a stellar piece of advice my wizard of a husband gave me after he had watched me study for a while and helped fix my code. It goes something like this: TEST! At every point, every iteration, test your code and see that nothing broke and that everything works. Then move on. My method of jotting down a full lesson and then implementing all the elements of it before testing led me to a mess of a place. Thank God I have a genius for a husband, he could get me out of the trouble I caused myself.
Pink Textures
Sometimes it happens, that we import some assets. And then we scream into the void when said assets are an incohesive pink mass on our game scene. This happens a lot to me when using CodeMonkey’s assets, those provided with the course, of course. You see, his course is running on an older version of Unity. When Bolt was Bolt, and Shader Graphs didn’t have two separate nodes to begin with.
So here’s how I solved it, eventually.
#1 Check that your URP (Universal Render Pipeline) Package is installed. I know, I know, rookie mistake but hey – we get so many pre-installed packages in the new Unity versions that URP should be a part of it. Especially when picking the URP projects… After you’ve done that, check that your URP Asset and Global Settings are in order.
#2 Check that your Project Settings in Graphics and Quality are set to URP Asset
#3 Check your Post Processing setup – the PP Gameobject should have a Volume component, and the Main Camera should have the Post Processing box ticked.
#4 Check your Shader Graph. I often have a problem trying to use the ones CodeMonkey uses, as they are outdated by now. Always make sure you use the appropriate Graph versions. Again, rookie mistake, but one that threw me for a loop a few times! After I stumbled around a bunch, I started pulling my old shaders from the previous learning projects.
And that’s how I troubleshoot the whole pink texture situation these days. Visuals, man, they can be a pain in any devs ass.
Broken UI
At some point in my studies, I decided to playtest the game. I died, and hit the ‘Retry’. Nothing happened. I tried again. Same result. I started to panic and tried the settings button. Nothing. I restarted Unity. You guessed it, nothing!
It was bizarre since the other elements worked just fine. My arrows and health were counting just fine, it was just the clickables that were revolting. I made a new button, but it didn’t work either. I was starting to get truly baffled.
Everything worked fine, I had no duplicates, and all the components were present and accounted for… even the event system was looking at me like ‘what you want form me?!’.
And then it hit me. This nonsense began after I had created my Transition. A black screen with opacity transparent, that goes black and fades out after a transition. That blasted Unity Hierarchy had got me again! CodeMonkey solved it by moving the Transition in the Hierarchy. My husband did not like that one bit, as it is ‘hacky’. So he showed me how to make the Transition independent from the whole Hierarchy system. He helped me set it up so that the image would be enabled and disabled when needed using animation events, and it would not passive-aggressively block the whole rest of the UI from working.
Broken Buttons
And then I managed to break my interactable buttons. Flips didn’t flip, spawner spawned and had apparently highjacked the flip to spawn more while the push button just plain refused to do its job. It was havoc, I tell you! And then the error showing push-button began spawning enemies as well. Which was funny, yet slightly infuriating. So I had a mystery to solve: Why do all my buttons, except the original Push that slaps me with errors, insist on inhabiting the world with random mobs?
I’ve learned that it is best to tackle one problem at a time, so I chose to see why the original button didn’t work. With my limited logical processor, I deduced that the error, ‘GameObject cannot be made into a Boolean’, actually meant what it said. So I hunted it down. And once I found it, I facepalmed.
I had actually tried to make a solid object into a Yes or No situation. No wonder it wouldn’t work. And this wasn’t the only place we’d find this problem, either. I had, after all, copy-pasted some of the Visual Script onto other places.
Just, when Visual Scripting, don’t be like me and haphazardly slap the connections wherever, this thing makes debugging so annoying! All the hunting of where and what… It’s not like the actual code, where Unity will jump you to the exact line of code that it thinks you have a problem with.
So that was solved, the button opened the door as it was supposed to. The next question was: Why does my flip switch spawn enemies and while doing that, will not even flip from red to green?
I removed the Update Visual part, and the flip started switching. Mind you, it didn’t work yet, but a small victory is still a victory. We got the flip to work, but for some reason, it crashed the game right after the door vanished. To be honest, I have no idea what happened there, as my husband possessed my fingers and we went to work cleaning the code.
Now, I know that coders have all their preferred ways of doing things, it’s sort of like the writer’s voice, if you know what I mean. As it happens, CodeMonkeys code voice is not what my husband would call ‘efficient’ or orderly, so, he revamped the whole Visual Script with me.
We removed some nodes that were, in fact, completely unnecessary and even made the situation more complicated than it needed to be. This made the Doors and Buttons rulers of their own destinies, instead of being hyper-attached to their counterparts. You can see the pattern here, my husband (and me for that matter as I see how he magics a mess into a functioning thing) is a believer in singular elements that hold their own lives. The cringe is strong when he sees the systems that are so intertwined that debugging becomes a chore and a half by itself.
We also found the other object wanting to identify as a boolean and told it the harsh reality of its true nature. My dear game object, no matter how hard you try, you will always crash the game if you keep holding on to that boolean connector. Reluctantly, it let go and the game now had functioning flip switches for doors.
Oh and… Please do mind your detection radiuses and the distances in your testing environment. Turns out that Overlap Circle of 3 was way too big, which is why the flip was seemingly spawning mobs – you know, since the mob push button was well within the Circle. How about that for another Facepalm?
What’s next?
Right now, I don’t know when I will be able to work on Devving again. The holiday season is upon us, and the freelancing work floods in. In the Hierarchy of Projects, my writing WIP always comes before the other two. And unfortunately, I won’t be able to make the thing independent of the Hierarchy, as I did with the Transition. It is what it is.
The next lessons in the course deal with a star collection mechanism, the game win scene, and the main menu. After that, it’s time for a bunch of polishing such as adding juice in the form of effects and making the world an actual game instead of a test sandbox for a crazy rookie dev.
I expect the Translation orders to taper out somewhere around January/February since not much is going on at the beginning of the year commercially. That’s when I should be able to begin more time into my projects, including this one. I’m excited to continue it, and I have some serious plans for making my first truly original game from scratch once I finish the course! I just need to decide if I want to do it in Visual Script or code. I suppose we’ll see!
Have a wonderful Holiday Season, and tune back in to see what ridiculous mistakes I make in the next DevLog!