Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Creating your creature prefab in unity

LeeTwentyThree edited this page Nov 21, 2021 · 6 revisions

Initial remarks

Every creature that is seen in-game should have a prefab in the AssetBundle.

Steps

1. Create an empty GameObject and save it as a Prefab

This GameObject will be your prefab. Name that new GameObject to the name of your creature (it doesn't really matter what it is, just make sure it's something unique and something you will remember). Drag that new named GameObject from the scene hierarchy and into the project window. Make sure it is included in the AssetBundle. You may now delete the GameObject you created in the scene, because you will instead be editing it as an actual prefab.

2. Add the model

Drag the model inside of this prefab. Make sure it looks right and is the right scale.

Materials

Make sure the creature has the materials set correctly. Ensure you're using the Standard (specular setup) shader that is provided in Unity. Transparent materials should have the word "Transparent" in the name, and solid materials should NOT. The game doesn't use the Unity standard material, but ECC efficiently converts it to the Subnautica shader (MarmosetUBER) so you don't need to worry about any of that stuff. Some data will be lost between the transition, though, so make sure to look out for that.

Animator

A good animator is a huge part of making a Subnautica creature look good. There are certain parameters that are set based on the creature's current state (look into the AnimateByVelocity component, which every fish has, with a decompiler), but I will go into that in another page.

A creature NEEDS an Animator somewhere in its hierarchy, in order to avoid NREs.

3. Add colliders

It really doesn't matter what type of collider(s) you add. Subnautica creatures are notorious for having hitboxes which are nothing more than a sphere around the head. If you've ever tried to scan a leviathan, you would know.

It's preferred to have only ONE collider, but it's completely okay if your leviathan has multiple colliders. Just please make sure colliders are located on the ROOT of the prefab. Otherwise it may have collision issues.

4. Make sure it looks right in unity

Place it in a scene, tweak animator parameters at runtime, etc...

Visual example (open externally to zoom in):

Screenshot of the Unity Editor