docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetValue

    SetValue(GameItem, StatDefinition, StatValue)

    Sets specified StatDefinition on specified GameItem to a specific value.

    Declaration
    public static void SetValue(GameItem gameItem, StatDefinition statDefinition, StatValue value)
    Parameters
    Type Name Description
    GameItem gameItem
    StatDefinition statDefinition

    StatDefinition this method is to act upon.

    StatValue value

    New value of Stat to set for this GameItem.

    Exceptions
    Type Condition
    ArgumentNullException

    If the gameItem argument is null.

    ArgumentNullException

    If the statDefinition argument is null.

    InvalidCastException

    If the StatValueType doesn't match StatDefinition.

    DetailNotFoundException

    If the StatDetail is not found on GameItem.

    StatDefinitionNotFoundException

    If the StatDefinition is not found.

    SetValue(GameItem, string, StatValue)

    Sets specified StatDefinition on specified GameItem to a specific value.

    Declaration
    public static void SetValue(GameItem gameItem, string statDefinitionId, StatValue value)
    Parameters
    Type Name Description
    GameItem gameItem

    GameItem upon which Stat is to be set.

    string statDefinitionId

    Id of StatDefinition this method is to act upon.

    StatValue value

    New value of Stat to set for this GameItem.

    Exceptions
    Type Condition
    ArgumentNullException

    If the gameItem argument is null.

    ArgumentException

    If the statDefinitionId is null or empty.

    InvalidCastException

    If the StatValueType doesn't match StatDefinition.

    DetailNotFoundException

    If the StatDetail is not found on GameItem.

    StatDefinitionNotFoundException

    If the StatDefinition is not found.

    SetValue(string, StatDefinition, StatValue)

    Sets specified StatDefinition on specified GameItem to a specific value.

    Declaration
    public static void SetValue(string gameItemId, StatDefinition statDefinition, StatValue value)
    Parameters
    Type Name Description
    string gameItemId

    GameItem upon which StatManager is to set the stat.

    StatDefinition statDefinition

    StatDefinition this method is to act upon.

    StatValue value

    New value of Stat to set for this GameItem.

    Exceptions
    Type Condition
    ArgumentNullException

    If the statDefinition argument is null.

    ArgumentException

    If the gameItemId is null or empty.

    InventoryItemNotFoundException

    If the gameItemId is not found.

    InvalidCastException

    If the StatValueType doesn't match StatDefinition.

    DetailNotFoundException

    If the StatDetail is not found on GameItem.

    StatDefinitionNotFoundException

    If the StatDefinition is not found.

    SetValue(string, string, StatValue)

    Sets specified StatDefinition on specified GameItem to a specific value.

    Declaration
    public static void SetValue(string gameItemId, string statDefinitionId, StatValue value)
    Parameters
    Type Name Description
    string gameItemId

    GameItem upon which StatManager is to set the stat.

    string statDefinitionId

    Id of StatDefinition this method is to act upon.

    StatValue value

    New value of Stat to set for this GameItem.

    Exceptions
    Type Condition
    ArgumentException

    If the gameItemId is null or empty.

    InventoryItemNotFoundException

    If the gameItemId is not found.

    ArgumentException

    If the statDefinitionId is null or empty.

    StatDefinitionNotFoundException

    If the StatDefinition is not found.

    InvalidCastException

    If the StatValueType doesn't match StatDefinition.

    DetailNotFoundException

    If the StatDetail is not found on GameItem.

    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)