Skip to content

Game.Prefabs.ResourceStackInEditor

Assembly: Game
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType

Summary:
Serializable value-type representing a stack of a specific resource used in editor contexts (prefab editing). Holds a reference to a ResourceInEditor entry and an integer amount. Typically used to represent how many units of a resource a prefab contains or requires while editing prefabs in the editor UI. The struct is attributed with [Serializable] so it can be serialized by .NET/Unity serializers where applicable.


Fields

  • public ResourceInEditor m_Resource
    Reference to the resource definition used in the editor. ResourceInEditor is declared in the Game.Economy namespace and describes the resource type and editor-specific metadata.

  • public int m_Amount
    Integer amount/count of the resource in this stack. Usually represents a non-negative quantity of the resource associated with the prefab in the editor.

Properties

  • (none)
    This struct exposes only public fields and does not define any properties.

Constructors

  • public ResourceStackInEditor()
    The default parameterless constructor is the implicit value-type constructor provided by C#. It initializes m_Resource to its default value and m_Amount to 0. No custom constructors are defined in the source.

Methods

  • (none)
    This struct does not define methods — it is a plain data container intended for storage/serialization and passing resource stack data in editor code. Be mindful that as a struct it uses value semantics (copy on assignment).

Usage Example

// Example: create and populate a resource stack in editor code
var resourceEntry = new ResourceInEditor
{
    // initialize ResourceInEditor fields as needed
};

ResourceStackInEditor stack = new ResourceStackInEditor
{
    m_Resource = resourceEntry,
    m_Amount = 100
};

// Passing stack around will copy the struct (value semantics)
ProcessStack(stack);

void ProcessStack(ResourceStackInEditor s)
{
    // s is a copy; modifying s here won't modify the original instance
    Console.WriteLine($"Resource: {s.m_Resource}, Amount: {s.m_Amount}");
}