Menu

Knight Ferret Studios

Knight Ferret

Simple Modular Fences

Simple Modular Fences is a contains various types of wood, metal, and stone fences, along with gate for those fences, and some cage walls (which are pretty similar to fences). Variants are include for most types to fit different workflows. In addition to the fences themselves you get posts, slats, and bars related to those fence. Also included are gates, scripts to open gates and doors, and a couple bonus materials.

The models are basic modular place, to place in a scene. If you know how to build with scene view in the editor, you know how to use these. They should work with any third party tools that can place prefabs, of course.

If you are using URP (and don’t know how to convert the standard materials on your own) the URP folder contains a package that will replace the materials with URP versions.

Nothing is rigged and no animations are included, but scripts are included to animate openable gates through transforms. These include three scripts that may be applied to game objects, a base class, and an interface.

A few naming conventions:

Materials and Textures

In addition to the textures and materials used on the existing prefabs, extra materials are provided for those who would prefer a more rusted or petinaed look on their metal fences and gates. A grass texture is also included, since it was needed for the demo and as it is part of the asset pack you are of course free to use it.

The stone fences / walls should work with many other tiling brick patters, with those having 4-across and 8-vertical bricks being particularly suitable. Of course, if you don’t like the included materials, or just want more variation or to fit better with other assets you are free to experiment with other materials on any of the models.

Door Opening Scripts

Included are a handful of fairly small, simple scripts for opening doors.

All scripts are triggered by calling their Activate() method, though Open() and Close() methods can also be called if you only want the door to move one way.

Using the Scripts

To use the scripts you will need a hierarchy of game objects in the prefab being opened.

To create a door that swings on a hinge or otherwise rotates open, you will need to a hinge transform (usually an empty), which acts as the pivot around which the door will swing. This should usually be on or just past the edge of the door and inline with any visible hinges in the model. The door must be a child of the hinge, and the script may be placed on the hinge or on a containing game object or empty.

Simple Modular Pillars with Other Creators Assets

The values in the script should be fairly self-explanitory: Hinge is the hinge transform. Axis Of Rotation is the axis it will rotate through, usually Y for a door or gate, but might be X for a chest, while a trapdoor might have X or Y depending on its orientation. Side is the side the door would be on if is (or were) a double door, looking from the front; in effect, it is the side hinge is on relative to the door. Close Angle is simply the angle the door should be at when closed, while Open Angle is the angle when fully open. Time To Open is simply the amount of time it will take to move from open to close position or vice-versa. Finally, Open is simply if the door is currently open, and can be used to configure that starting position of the door from the inspector.

To create doors or gates that move to open, such as a portcullis that can be raised or lowered at the entrance to a castle, use the Moving Opener script.

Simple Modular Pillars with Other Creators Assets

The moving game object, the door or gate, needs to be placed in a container with two empties positioned where where the game objects should be when open and when closed. The container may be an empty or any object they are part of or attached to. The variable you need to set in the inspector are those, plus Time To Open and Open, which work exactly the same way as with the hinged opener.

The MultiOpener script simply allows you to create lisst of other simple opens (including hinge openers, moving openers, or even other multi-openers) that it will all be activated when it is; it simply forwards the calls to Activate(), Open(), and Closed() to any of the door openers in its list.

Calling Activate, Open, or Close from another script or with unity events wired in the inspector should be all it takes to make it work. Of course, it could be used for more than just doors and gates – lids on chests, or ever traps the swing a blade out or jab with something could also be animated with these scripts.


Get Simple Modular Pillars on the Unity Asset Store