Category Archives: Unity

Strange scripting errors

While adding the moving platform script to different game objects I found some very peculiar behavior presenting itself. When I added the holder script to my small platform everything works like a champ. Hop up on the platform, take a ride, jump up and down, walk off and everything works fine. When I add the holder script to the other platform using a little fancier script for the movement all hell breaks loose. Objects that have no association what so ever with the other platform start moving, even on game object off in the distance. I was and still am stumped by all that movement. When I adjusted the holder script with a check to identify the object entering the trigger and only will be affected by an object it should be affected by e.g. the Player all that extra movement stopped and the script started trying to act as it should. There is still a small bug but I’ll get to the bottom of that. When I do I’ll expand on that bug and the fix.

Latest: depending on how I am moving the platform ‘moving’ or ‘Vector3.Lerp’, when I parent the first person or third person controllers will result in how the controller will act. If I ‘move’ the platform, parenting seems to have no effect. When I Vector3.Lerp the platform parent works just fine and the character controller follows along great. The first person controller behaves a little weird as in the camera changes position (probably because to the parenting but I’ll get that fixed as it is a minor problem. Now I have to figure a way to move the platform without using Lerp because I don’t like that movement, I want the movement more liner rather than damped as the Vector3.Lerp is. I have a couple if ideas but I’ll check the online documentation first.

Back to Unity Book

I am back to translating the unity Book creating the Garden Gnome game into Unity 5. Stepping back I decided to change around how the platforms move in the test scenes and found some great ideas for a script that should give me a lot of flexibility. We will see how it works. I’ll post an early update as soon as I get the script the way I want which should be soon. Looking at the scripting references it should be fairly straight forward.

WoodMan

I created the WoodMan shown in the last post and using Rigify added a simple rig, exported as .FBX then imported. By just adding the animator component and using the mocaps from the asset store was able to animate the character in nothing flat.

Results:

Unity Stealth

I spent the end of last week working with the Unity Stealth project in Unity 5. Reading some of the comments about this project with Unity 5 I had some concerns with adapting the old learning project. So I have complete 3 of the four chapters and have had just about zero problems converting everything. The only errors I have had have been my own typographical errors. I consider that pretty dang awesome.

Unity “Learning” tutorials

Some of the “Learning” tutorials on the Unity web site are out of date. One in particular was out of date when the new UI system started to be implemented at 4.6 (last year). I feel this is good for me. Now I can start using some of the techniques I should have beem learning from all the books, videos I have been reading and watching in order to get up to speed with Unity 5. Reading, watching and writing snippets of code are one thing, doing is completely different. I am a firm believer in the notion that if you can imagine yourself completing a task, your brain does not know the difference from you actually completing a task and your imagining yourself completing a task. The difference here is seeing my self completing this and the code itself actually working 🙂

A good example of this was the complete rewrite of some UI code, when I was finished the script was less than half the size of the original. Kudos here to Unity for creating a UI requiring substantially less code than the old UI objects and seemingly easier to use.

However, there are some areas of the scripting that use a lot more code than previously so I guess you can call it a wash. I’ll place some examples of both here to  remind me of what has changed and what I need to do and also for anybody that may come into this site and might find the information useful.

Unity 5 Image Effects

Here are four images showing the additional image effects provided in Unity 5 and I love playing with them. There are much more where those come from, I have not touched on the abilities.

Without Effects

Texture_Testing4

With Effects

Texture_Testing3

Without Effects

Texture_Testing2

With Effects

Texture_Testing1

Up and coming works

I have been spending many hours this week working on some test project in Unity 5 concentrating on the new features available now so get ready for the next post. Given the simplified versions I have shown here just adding additional rendering effects improves the look an order of magnitude.

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 🙂

Unity Personal Edition

Well, sometimes wishes do come true.

I had said I was hoping Unity Free would go away, have pro features for everyone or maybe a subscription type of system. Well the best of both worlds happened last week. Unity released version 5 with a Pro subscription of 75.00/month or 1500.00 for a perpetual license and the old Free version of Unity has been put to the pasture. They released the Personal Edition having all of the features of Pro with none of the restrictions the old free version had, with the exception of a splash screen for the personal edition and no dark skin.

The pro subscription gives you asset store 11 which is monthly deals provided only to pro users etc.. Team licenses (I think that is what it is called, cloud storage, pro community access and other things, none of which interest me.

If you want some funny reading you should head on over to the Unity community ‘discussion’ thread and look at all the bitching about the splash screen specifically the words ‘personal edition’ within the splash. The absolute childishness of some of these people is revolting (although funny).

I am loving the anouncment, Unity Pro is now free. 🙂 🙂

Blender Models export to Unity

I have been doing some experimenting with exporting models from Blender to Unity3d using the FBX export and have found more success than failures. I found this strange as it seems when I read about others in the Unity Community exporting the same way there seem to be a plethora of problems.

I created this simple pad in blender
SimplePad

Using these settings I exported the file as an FBX, placed the file with my assets in the Unity project. The secret for proper orientation from Blender to Unity? Make sure Forward is “-Y Forward” and Up is “Z Up”. As you can see, this is how the model is prepared within Blender NOT how you wish to see it in Unity. When I first did an export I had this backwards.
FBX_ExportPanel

After adjusting the scale factor to one and removing any inspector clean up (apply any changes) I drop the new asset into the scene. With this result and as you can see the item is place properly with orientations correct for a Unity asset.
Unity_Import_FBX

Once I figured out the proper way to import the asset from Blender I created a preset within the FBX export panel. This way I have these settings ready for any other assets created within Blender.
FBX_ExportPanel_Preset