docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AdjustStat

    AdjustStat(string, StatValue)

    Adjusts the value of the StatDefinition by its given statDefinitionId by adding the change to its current value.

    Declaration
    public StatValue AdjustStat(string statDefinitionId, StatValue change)
    Parameters
    Type Name Description
    string statDefinitionId

    Identifier of the StatDefinition to adjust.

    StatValue change

    Change to apply to the current value of the stat.

    Returns
    Type Description
    StatValue

    The new value of the stat.

    Exceptions
    Type Condition
    NullReferenceException

    If this GameItem instance has been discarded.

    ArgumentException

    If the statDefinitionId is null, empty, or whitespace.

    InvalidOperationException

    The parameter refers to a stat of a different type.

    ArgumentNullException

    The statDefinitionId parameter refers to a non-existing StatDefinition.

    AdjustStat(StatDefinition, StatValue)

    Adjusts the stat by specified amount.

    Declaration
    public StatValue AdjustStat(StatDefinition statDefinition, StatValue change)
    Parameters
    Type Name Description
    StatDefinition statDefinition

    The stat to adjust.

    StatValue change

    Change in value to the Stat.

    Returns
    Type Description
    StatValue

    The new value of Stat on this GameItem.

    Exceptions
    Type Condition
    InvalidOperationException

    The parameter refers to a stat of a different type.

    ArgumentNullException

    The parameter is null or empty.

    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)