top of page
Unity - Level Design Tools
Intentions
It's been two years I've been learning programming alone and it was time to face some technical challenge, I thought creating some tools in Unity could be a good one.
​
I started a project inspired by Smugglers (My 2D game prototype) in 3D with the same mechanics.
​
Since I wanted to have traffic cars, I needed both a road network and basic AIs.
​
That's how I started coding the tools I'll describe below.
The tools
Road snapper
A simple tool that allows me to snap the road portions I created together, by dragging them beside.
Pretty simple to use, the current state of this tool allows me to build easily what I want really quickly.
​
However there are still a few issues to be fixed.
Road builder
A more complex tool that gives me the power to build my road network from a sole window.
The current development state of the tools allows me to build even more complex road networks.
These tools are still under development and still need a lot of love, for example, the rotation / position management of the roads being placed are hard coded.
​
I managed to find a way to generically do that.
Code samples
Here is how I handled the snapping system : each rotations was handled separately, every value was hard coded ...

This sample represent the snapping system for roads to connect to turns, only on one side.
​
This kind of code was present for 3 different road portion type (Road / Road Turn / Cross Roads) and handled the 3 road portions snapping. It represented more than 1000 lines of code ...
I found a way to ask the road to calculate the current position of their connectors (forward and backward one).
​
I use this value (a Vector3) and inject it into my snapping functions (below).

Now, I handle the snapping just by calling the functions SnapToRoadConnector()

- No more hard coded values
- No more particular cases
- Saving a lot of space and time
- Easy to debug / trace
There is still a lot to do, and to discover, but this thirst step gave me the will to carry on programming my own tools.
bottom of page