The presenter in the Scavengers tutorial barrels along faster than I can type, and I'm not slow. I was pretty sure I'd miss something. And I did. My food and soda wouldn't pick up and it took me a long time to realize I'd misnamed my method with 2d instead of a 2D.
But what really got me wasn't something I could control. When my level was resetting, it wouldn't recreate the board. I changed from a deprecated method to the new loadscene version. And then I started putting in debug.log statements (didn't I say this felt like old school VB once before?). After trying to narrow it down, it appeared my Awake function wasn't triggering, so the board wasn't repopulating. I compared their completed version with my version of the script, and the prefab, everything else, all to no avail. Finally, in this five year old post (long before the current version of Unity) someone mentioned that Awake() doesn't always refire and you have to code it up under OnLevelWasLoaded() to catch logic after the first time. I dropped it in there - cut and paste rather than appropriate refactoring - and success! So for anyone else who's getting Awake() or InitGame() events that aren't firing when they expect them to, OnLevelWasLoaded() is a good place to call your logic again to be sure it triggers.
You can see the affect of the bug on not rebuilding subsequent levels in the video.
Showing posts with label scavengers. Show all posts
Showing posts with label scavengers. Show all posts
Friday, March 11, 2016
Saturday, March 05, 2016
80/20
The 80/20 rule (Pareto Principle) applies to playing around in Unity3d as well. 80% of the work comes from 20% of what you're working on. I decided to move on beyond the Space Shooter tutorial when I got to the part where I'd need the Apple or Android SDK (or Windows). Not that I'm adverse to using them or can't, I've used all three, but I thought learning more basics rather than significantly more configuration work was preferable. So I started the 2D adventure game tutorial series.
1.) I was immediately amused because I'd had an intern candidate telling me about his Game Conference challenges using Unity2d and he'd discussed a "cookbook" game with a demon hooking to a JSON data source. The Scavengers setup sure seems like the base application his team likely modified for their competition. Wish I had played around with it before the interview. I don't think he was expecting an interviewer who'd touched Unity (recently). I asked a number of questions related to prefabs and how they compared to a traditional OOP structure and whether coroutines were threading (they're not, and there are a few tutorial videos out there on the topic of yielding to the main thread versus spawning new threads in C#).
2.) Getting back to the Pareto Principle, during the first real lesson after the introduction, I did something that eliminated my main camera. So when I went to watch my little adventurer bounce up and down like he was wanking to pass the time, I couldn't find him. Or his two wanking monster buddies. I had no problems putting the camera back, but the default settings weren't the same. I eventually had to boot up a new project and check the defaults. Unity was resetting the Transform.z to 0 instead of -10 and the depth to 0, instead of -1. I updated the values and there they were. Like looking for a needle in a haystack. Here's a default Main Camera, should I ever need to get my mitts on it again. It took quite a while of dicking around with settings and looking online before I gave up and did the new project. Seriously - I'm still trying to make it work in my head - I assume because my characters were at 0 and my camera was at 0, that I was in some sort of Flatworld universe where I couldn't see them.
1.) I was immediately amused because I'd had an intern candidate telling me about his Game Conference challenges using Unity2d and he'd discussed a "cookbook" game with a demon hooking to a JSON data source. The Scavengers setup sure seems like the base application his team likely modified for their competition. Wish I had played around with it before the interview. I don't think he was expecting an interviewer who'd touched Unity (recently). I asked a number of questions related to prefabs and how they compared to a traditional OOP structure and whether coroutines were threading (they're not, and there are a few tutorial videos out there on the topic of yielding to the main thread versus spawning new threads in C#).
2.) Getting back to the Pareto Principle, during the first real lesson after the introduction, I did something that eliminated my main camera. So when I went to watch my little adventurer bounce up and down like he was wanking to pass the time, I couldn't find him. Or his two wanking monster buddies. I had no problems putting the camera back, but the default settings weren't the same. I eventually had to boot up a new project and check the defaults. Unity was resetting the Transform.z to 0 instead of -10 and the depth to 0, instead of -1. I updated the values and there they were. Like looking for a needle in a haystack. Here's a default Main Camera, should I ever need to get my mitts on it again. It took quite a while of dicking around with settings and looking online before I gave up and did the new project. Seriously - I'm still trying to make it work in my head - I assume because my characters were at 0 and my camera was at 0, that I was in some sort of Flatworld universe where I couldn't see them.
Subscribe to:
Posts (Atom)
