Website powered by

Modular Weapon Generator for Unity

In this project I created a generator for modular weapons. I programmed it in C# and made the parts in Blender.
The gun is stored in an empty game object (gunManager). The object has a script wich creates an array for scriptable objects. One is the rifle body and the other two are rifle handles I reused als pistol bodies. The the scriptable object stores the prefabs of those bodies. Attached to them are several empty objects that are later filled with a random attachment. When the gunManager script is activated it picks one of the three scriptable objects to generate. Then it fills the attached empty objects by random.
The weapon itself is set as a child to another empty object, calles gunContainer. The container is mostly used to optimize the way the gun is presented. The container is also responsible for the rotation.

Those are the rifle parts I created.

Those are the rifle parts I created.

A screen recording that shows the working generator in Unity.