Importing and using Blender Models in Unity - Tut Devlog


Recap

In my last Devlog you might remember my low poly police officer character I made! 

I was quite happy with him, he had some really solid animations that I really liked! The pointing one wasn't the best but the running one and Idle one looked really good! But as I opened it when I tried to import it into unity I found that I'd lost my good running animation ( Seen in the last Devlog) so I had to throw together a lesser version that you will see later in this post. He was fully rigged up with armature and ready to go.

Exporting

In Blender, I exported him as a .fbx file and then imported it into Unity and I had two issue. The first issue was that his textures didn't map properly, I never found the true reason why this happened. I extracted the material from the model and applied the texture but I couldn't get it to properly attach to the model and many vertices didn't want to connect properly causing the hat to break and the eyes to sink into the head. 

I fixed the hat issue by deleting merging duplicate vertices that I accidentally created. This stopped the hat breaking but I could't fix the eye problem. The texture issue still persisted but it was slightly textured after fiddling more with exporting settings. In future to fix this an easy way would be to use multiple materials so solid colours could be chosen in unity or Fix the UV editors assignment issues. 

He Ended up looking like this, not too bad but not great.

 

Animations

After recreating the running animation and fixing the model, the animations because pretty easy to use. I created a pretty simple Animation controller which had 0 exit time transitions. There are two Boolean values that control transitions, walking and pointing which change into each corresponding animation. Having movement as a Boolean is not great practice but it was a pretty easy way to get the animator working well quickly. 

These values are controlled via 2 scripts (Not generally good practice), one is in the movement controller and is enabled whenever the character is moving, and the other one is in a script called AnimController which turns the point and whistle on and off. 

Other Character setup

The character has a few other things to get it working, a box collider trip the door trigger (Talked about later), set as  trigger, a rigidbody to keep him grounded like a real g, a Camera object that is attached as a child to the player to get a 3rd person view (Rotated in the above GIF). 

World and Purple door

Lastly, I created a basic "Room" for my character to exist in with a door that is opened with a trigger in the doorway.  The room is constructed with 4 cubes that have been scaled to create thin walls and a small rectangle for the door. The door has a Gameobject on it which has its own box collider that is set as a trigger. This lets me create a triggerDetection script that will let me disable the door's gameobject and "Open it"


Conclusion

Importing models and setting up animations should be a very easy process but with my lack of Blender skills I found that it was quite difficult but nothing that I couldn't Fix. I've really found that Blender and 3D modelling isint my strong suit and if I want to get better at it I will have to put a lot of effort into learning better techniques and gaining more skills before I can create game level models

Get KIT207 Portfolio

Leave a comment

Log in with itch.io to leave a comment.