Skip to content

Game.Prefabs.PrefabIdentifierInfo

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: class

Base: System.Object

Summary:
A small serializable data container used to identify a prefab by name and by a string-based type identifier. Commonly used in data structures that need to record or transmit a reference to a prefab without holding a direct engine reference (for example, in saved data, configuration assets, or lightweight serialization used by mods). Marked with [Serializable] so Unity's serializer can serialize it when it is a field of a serializable object.


Fields

  • public string m_Name
    Name of the prefab. Typically this should match the prefab's internal name (the one used by the game to register the prefab). May be null or empty if not set; callers should validate before use.

  • public string m_Type
    String identifier for the prefab's type. This is not a runtime type reference but a textual type/category used by the system that created the PrefabIdentifierInfo (for example, "Building", "Prop", "Vehicle", or a class name). Used to disambiguate or categorize the referenced prefab when needed.

Properties

This type exposes no properties.

Constructors

  • public PrefabIdentifierInfo()
    Default parameterless constructor supplied by the compiler. Initializes both m_Name and m_Type to null. You can instantiate and then assign the fields, or create helpers/factory methods in your mod code to populate instances.

Methods

This type defines no methods.

Usage Example

// simple creation and use
var info = new Game.Prefabs.PrefabIdentifierInfo();
info.m_Name = "SmallHouse";
info.m_Type = "Building";

// check before using
if (!string.IsNullOrEmpty(info.m_Name))
{
    // hypothetical helper that looks up a prefab by name
    var prefab = PrefabCollection<BuildingInfo>.FindLoaded(info.m_Name);
    if (prefab != null)
    {
        // use prefab...
    }
}

Additional notes for modders: - Because this class is [Serializable], it can be a field inside MonoBehaviour/ScriptableObject classes and will be serialized by Unity's serializer (visible in the inspector only when part of a serializable type). - The class stores plain strings rather than direct references to engine types. When using these identifiers at runtime, you will typically resolve them to actual prefab objects via the appropriate PrefabCollection or game API. - Validate m_Name and m_Type before using to avoid null-reference or lookup failures. - This class is trivially copyable and not thread-safe if you mutate instances from multiple threads; prefer creating and passing immutable data when using background jobs.