I have to say, the Unity app for the iPhone seems to be lacking without bluetooth, but the fact that I can just wire it in and run my app simultaneously on a PC desktop and iPhone is amazing. Seriously cool. Having to download 22 GB of install because I didn't grab the iPhone/Android/et al packages the first time? Not so cool. But that was my own fault. It's slick to point the app at multiple platforms with so little effort.
Showing posts with label unity2d. Show all posts
Showing posts with label unity2d. Show all posts
Sunday, March 20, 2016
Friday, March 11, 2016
Troubleshooting
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.
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.
Monday, March 07, 2016
Disturbing
I messed up the animation script for the roguelike tutorial in Unity. It's a little worrisome looking. I said at one point he was just standing around wanking. Seems even shadier in this video.
Saturday, March 05, 2016
Adventure Game, Progress
I took a short break during some coding to go for a bike ride. Darn nice out there, although still a bit chilly on the gloved hands if you're moving fast.
I ran into a few issues getting the basic board controller working. I dragged the sprites onto the game objects rather than into the sprite controllers, so when I ran the board creation loops, there was nothing to create. Had me at a loss because my code looked spot on but I was still seeing a great big empty field. Took a lot of work to clean it all up because modifying the prefabs resulted in messing up my board controller.
The tutorial walked me through a singleton pattern attaching the game controller to the camera by checking for the singleton instance. I'm never going to believe a Unity programmer again when they tell me they don't know any software patterns.
There's my Win32 meltdown that crashed Unity. I'm pretty sure it's because I made an instance of the prefab and then deleted the prefab in an attempt to make a new prefab. I can't be certain, but I suspect it's like having an instance of an object with no object? The important thing is not to do it - very messy.
I ran into a few issues getting the basic board controller working. I dragged the sprites onto the game objects rather than into the sprite controllers, so when I ran the board creation loops, there was nothing to create. Had me at a loss because my code looked spot on but I was still seeing a great big empty field. Took a lot of work to clean it all up because modifying the prefabs resulted in messing up my board controller.
The tutorial walked me through a singleton pattern attaching the game controller to the camera by checking for the singleton instance. I'm never going to believe a Unity programmer again when they tell me they don't know any software patterns.
There's my Win32 meltdown that crashed Unity. I'm pretty sure it's because I made an instance of the prefab and then deleted the prefab in an attempt to make a new prefab. I can't be certain, but I suspect it's like having an instance of an object with no object? The important thing is not to do it - very messy.
Labels:
adventurers,
gaming,
unity,
unity2d,
unity3d
Subscribe to:
Posts (Atom)

