Table of Contents

Class RaceTemplate

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

ScriptableObject template for a race: models, attributes, starting abilities, inventory and equipment for playable races, and the naming data the name generator draws on for every race. A race with Playable off exists only to name things — it has no prefab or models, is skipped by character creation, and loads no placeholder model.

[CreateAssetMenu(fileName = "New Race", menuName = "FishMMO/Character/Race/Race", order = 1)]
public class RaceTemplate : CachedScriptableObject<RaceTemplate>, ICachedObject
Inheritance
Object
ScriptableObject
RaceTemplate
Implements
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Fields

BiomeAffinities

Biomes this race realistically belongs in, weighted. Naming draws a home biome from these when none is given, and spawners can ask which races suit a place.

[Header("Biomes")]
[Tooltip("Where this race is at home. Weighted; empty means no preference.")]
public List<BiomeAffinity> BiomeAffinities

Field Value

List<BiomeAffinity>

Category

Phonology, cultures, titles, places and city suffixes the name generator uses for this race.

[Header("Classification")]
[Tooltip("Broad family: Humanoid, Giant, Fey, Beastfolk, Beast, Draconic, Aquatic, Undead, Construct, Elemental, Outsider, Plant, Aberration. Title pools serve categories.")]
public string Category

Field Value

string

DefaultProportions

Default body proportions for this race. Applied via bone scaling on character spawn. Examples: Human (all 1.0), Dwarf (Height 0.75, LegLength 0.70, ArmLength 0.85), Elf (Height 1.05, LegLength 1.15, ArmLength 1.10).

public RaceProportions DefaultProportions

Field Value

RaceProportions

Description

Description of the race.

public string Description

Field Value

string

GenderedModels

Gender-specific model references for this race. Use Unspecified for generic/default models.

public List<GenderedRaceModelSet> GenderedModels

Field Value

List<GenderedRaceModelSet>

InitialAttributes

Initial attribute database for the race.

public CharacterAttributeTemplateDatabase InitialAttributes

Field Value

CharacterAttributeTemplateDatabase

InitialFaction

The initial faction for the race.

public FactionTemplate InitialFaction

Field Value

FactionTemplate

Naming

[Header("Naming")]
public RaceNamingData Naming

Field Value

RaceNamingData

PlaceholderModel

This model is loaded during ClientPreboot as a static model reference for this Race. It will be replaced by the player's selected model at runtime.

public AssetReference PlaceholderModel

Field Value

AssetReference

Playable

True for a race players can create and NPCs can be built from. False for a naming-only race: character creation skips it and no placeholder model is loaded for it.

[Tooltip("Off for a naming-only race: no prefab or models, hidden from character creation.")]
public bool Playable

Field Value

bool

Prefab

The prefab for the race.

public GameObject Prefab

Field Value

GameObject

StartingAbilities

List of starting abilities for the race.

public List<AbilityTemplate> StartingAbilities

Field Value

List<AbilityTemplate>

StartingEquipment

List of starting equipment for the race.

public List<EquippableItemTemplate> StartingEquipment

Field Value

List<EquippableItemTemplate>

StartingInventoryItems

List of starting inventory items for the race.

public List<BaseItemTemplate> StartingInventoryItems

Field Value

List<BaseItemTemplate>

Properties

Name

The name of the race (from the ScriptableObject name).

public string Name { get; }

Property Value

string

NamingKey

Key the name generator files this race under: the asset name lowercased with everything but letters removed, so "Wood Elf" is requested as "woodelf".

public string NamingKey { get; }

Property Value

string

Methods

AffinityFor(int)

This race's affinity for a biome, or 0 when it has none.

public float AffinityFor(int biomeID)

Parameters

biomeID int

Returns

float

GetModelCount(CharacterGender)

Gets the number of model references available for a gender, including fallback models.

public int GetModelCount(CharacterGender gender)

Parameters

gender CharacterGender

The selected character gender.

Returns

int

The number of available model references.

GetModelName(int)

Gets the display name for a model in the flattened gendered model list.

public string GetModelName(int index)

Parameters

index int

The flattened model index.

Returns

string

The model asset name, or an empty string when unavailable.

GetModelReference(CharacterGender, int)

Gets the model reference for the given gender and index, or the placeholder if selection fails.

public AssetReference GetModelReference(CharacterGender gender, int index)

Parameters

gender CharacterGender

The selected character gender.

index int

The model index.

Returns

AssetReference

The asset reference for the model.

GetModelReference(int)

Gets the model reference for the given index, or the placeholder if out of range or models are missing.

public AssetReference GetModelReference(int index)

Parameters

index int

The model index.

Returns

AssetReference

The asset reference for the model.

GetModels(CharacterGender)

Gets model references for a specific gender.

public List<AssetReference> GetModels(CharacterGender gender)

Parameters

gender CharacterGender

The selected character gender.

Returns

List<AssetReference>

The matching model list, or null when no matching gender list exists.

LoadPlaceholderModel()

Loads the placeholder model for the race using Addressables.

public void LoadPlaceholderModel()

OnLoad(string, string, int)

Called when the race is loaded. Loads the placeholder model.

public override void OnLoad(string typeName, string resourceName, int resourceID)

Parameters

typeName string

The type name of the resource.

resourceName string

The resource name.

resourceID int

The resource ID.

OnUnload(string, string, int)

Called when the race is unloaded. Unloads the placeholder model.

public override void OnUnload(string typeName, string resourceName, int resourceID)

Parameters

typeName string

The type name of the resource.

resourceName string

The resource name.

resourceID int

The resource ID.

PickHomeBiome(DeterministicRNG)

Draws one of this race's home biomes, weighted, with the given RNG; null when the race has no registered affinities. Deterministic for a seeded RNG, so both peers agree.

public BiomeTemplate PickHomeBiome(DeterministicRNG rng)

Parameters

rng DeterministicRNG

Returns

BiomeTemplate

UnloadPlaceholderModel()

Unloads the placeholder model for the race using Addressables.

public void UnloadPlaceholderModel()