Category Archives: Visual Studio

Looking for those darn bugs

Here is a clip of a small problem I had last week. It seems that when I killed my opponent my health immediately went to zero and I died as well. Here you can see I manually change the health of the opponent, he/she dies and poof so do I. Funny looking but not so funny when I could not find the bug.

Bug hunting is now over. I spent most of the day at work looking for this illusive critter and only after I went home, moved scripts around and segregated most of the code I finally found the problem. As it turned out, if I had taken the time to investigate at work like I had time at home I would not have had to do all the changes I did (but the code is nicer for it). All that had to be done was add the following to the condition of an if statement “&& !enemyController.dead”.

Below is the problem I experienced.

Visual Studio

I have spend most all of my free time getting back into programming in a big way and enjoying it more than I ever did in high school. It does amaze me how concepts I learned more than 30 years ago seem to come back in bunches now. This weekend I had created some methods in some very different ways than my instructors were doing, knowing inside that my way would work very well but had hit a road block with my code. I walked away for an hour or so and my brain went into overdrive in the background while I was thinking of others things. Thinking I had not been in Blender for a while and needed to get back with some modeling. As soon as I sat down to continue where I had left off I had the solution at my finger tips and it worked wonderfully. Now it is time to start documenting all of these coding snippets on YouTube or some other type of note taking application. Maybe I’ll start using OneNote on my Surface which should sync with all of my devices.

Unity and Visual Studio

This week I have spent most of my time with in Unity 5. Understanding and digesting what has changed has been a little difficult as there is no comprehensive list of changes. I have found the best way to achieve this is to work through the Unity Learning tutorials. I finished the Roll-a-Ball mini game and found quite quickly if there may be an issue with some code. Unity will catch the change and try to make the change for you, handy to say the least. One thing I have found and you are not warned about are the GUI differences and that is because the legacy GUI items e.g. GUIText is still available just not from your typical game object menu list as before. Because of this, the code will still work and you will not receive any compile errors however your results will not be what you expect. With a little searching of the web, YouTube, Unity Answers or the Unity Community you can find the solution you are looking for and if you study the code you can actually understand what is happening.

An old problem I have had was using Visual Studio as my default script editor. Each time I would pick a script to edit a new instance of Visual Studio would be opened instead of a new tab in the existing instance. Well, today there was a post in Unity Answers that addressed this specific issue and I was able to get this working beautifully today. In that same post there was a link to “Visual Studio 2013 Tools for Unity” and just reading about some of the features and they look very promising, love the API reference right in Visual Studio 🙂