Unity Update (Part 2)

I found on the community web site others were having problems, not quite the same but similar and tried their solutions with no success. Deciding to go back to version 5.1.0 I started downloading, paused with the intention of resuming at work. After getting to work all started up just fine. I changed my status to ‘working offline’ and downloaded 5.1.0 to my USB drive just in case I can’t work from home again. I shut down Unity, turned off the network connection and I was again able to open Unity with no problem. I will then try the network side again and see how that goes, Something tells me what has been happening has been a fluke and I will not be able to reproduce. I surly hope this is the case.

Looks like everything is working good now. 🙂

Good new info I learned today. If you make a variable public in C# you can have access to it from other scripts but is also visible on the inspector. I do not like this as the inspector gets to be too cluttered with information I don’t necessarily need to see all the time. I only want to have variables visible in the inspector if I need them to be. My revelation came when I realized you can have a pubic variable (accessible from other scripts) and invisible to the inspector by making them ‘public static’ variables. Best of both worlds, fantastic!

Unity update

Unity came out with a new update and I installed as all my projects currently are just test projects and would not be hurt by an upgrade that may be broken. This update did not seem to be broken when I installed but after shutting down at work and reopening the program at home I was welcomed to a new screen that was checking my licensing and would not continue. What is this since I use the personal edition. I had to uninstall and am now in the process of reinstalling. We will see it that fixes the problem.

Game Mechanics

One item I came across recently was when you should create your stunning graphics for your game and when you should work on the mechanics of your game. The term ‘game’ here is meaning any project your are creating using Unity or any other game engine. It doesn’t necessarily have to be a game it can be an interactive website or architectural walk through. The answer of course is game mechanics first, the art and object can be added later. While you are creating the game mechanics (e.g. scripts) your game object or assets can be anything (cube or sphere etc.) that can represent the physical size/area the actual objects will be. In other words you can make a cube move just as easy as a animated character or camera.

Working through some new videos I found and converting all the scripting to versions that will work with Unity 5. Today I had to set one aside as it just was not working. It all boiled down to the original author created a public Transform variable ‘player’ and then drag and drop the player game object into the inspector.

I wanted to create a private reference variable and assign the value in the awake function, no drag and drop leaving the inspector less cluttered. When I did this I created a private GameObject variable ‘player’ and a private Vector3 variable ‘playerPos’. I would then assign their values in the Awake() function by finding with tag then a GetComponet for the transform.position Vector3. The problem I had was nothing would work when I tried to use the playerPos while I was moving around.

Well duh! When I got home I realize I initialized the playerPos at awake and it did not matter how much I moved around the value of that variable would not change.. 🙂 .

Solution: private Transform variable ‘player’, assign in awake using ‘player = GameObject.FindGameObjectWithTag(“Player”).transform’. When referencing my players position during play just use player.position. Kept the inspector less cluttered and worked like a champ.

A needed Break

I took a break from any and all tech this week. The computers were down and the TV switched from the boring network crap and so called ‘news’ to Netflix.

It was a great relaxing time which is now over. Time for the real world again and back to Blender and Unity!