Game.Prefabs.SpawnableBrandDummy
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
SpawnableBrandDummy is a component used on game prefabs to hold references to one or more placeholder ObjectPrefab assets that represent brand/variant spawn options. It exposes an array of ObjectPrefab references (m_Placeholders) that can be assigned in the editor. The class overrides two methods that the prefab/ECS conversion pipeline can use to collect required ComponentType entries for prefab or archetype creation, but both overrides are empty in this implementation, so no additional ECS components are contributed by this component by default.
Fields
public ObjectPrefab[] m_Placeholders
An array of ObjectPrefab references used as placeholders/variants for the spawnable brand. These are typically assigned in the prefab inspector to define alternative sub-prefabs or branded variants that the spawning system can use.
Properties
- None
Constructors
public SpawnableBrandDummy()
Default constructor. No special initialization is performed by this class beyond the base ComponentBase initialization.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Called by the prefab conversion or packing pipeline to allow this component to add required ECS ComponentType entries to the provided set for prefab entities. In this implementation the method is empty, so it does not add any components. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Called when building entity archetypes to allow the component to contribute ComponentType entries. This implementation is empty and does not add any components to the archetype set.
Usage Example
// Example: reading assigned placeholders at runtime or in editor code
public class BrandHandler
{
public void PrintPlaceholders(SpawnableBrandDummy dummy)
{
if (dummy == null || dummy.m_Placeholders == null)
return;
foreach (var prefab in dummy.m_Placeholders)
{
if (prefab != null)
UnityEngine.Debug.Log($"Placeholder: {prefab.name}");
}
}
}
// Example: how a modder might extend GetPrefabComponents to add a tag component
public class CustomSpawnableBrandDummy : SpawnableBrandDummy
{
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
base.GetPrefabComponents(components);
// Example: add a custom tag component type so spawned entities carry it
components.Add(ComponentType.ReadOnly<YourCustomTagComponent>());
}
}