docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetStat

    SetStat(StatDefinition, StatValue)

    Sets the value of the given statDefinition for this GameItem instance.

    Declaration
    public void SetStat(StatDefinition statDefinition, StatValue value)
    Parameters
    Type Name Description
    StatDefinition statDefinition

    The StatDefinition to set a value for this GameItem instance.

    StatValue value

    The value to assign to the statDefinition entry of this GameItem instance.

    Exceptions
    Type Condition
    NullReferenceException

    If this GameItem instance has been discarded.

    ArgumentNullException

    If the statDefinition parameter is null.

    SetStat(string, StatValue)

    Sets the value of the StatDefinition by its given statDefinitionId for this GameItem instance.

    Declaration
    public void SetStat(string statDefinitionId, StatValue value)
    Parameters
    Type Name Description
    string statDefinitionId

    Identifier of the StatDefinition to set a value to.

    StatValue value

    The value to assign to the StatDefinition entry of this GameItem instance.

    Exceptions
    Type Condition
    NullReferenceException

    If this GameItem instance has been discarded.

    ArgumentNullException

    If the statDefinitionId parameter is null, empty or whitespace.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)