docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Remove

    Remove(string)

    Removes a local variable with the specified name.

    Declaration
    public bool Remove(string name)
    Parameters
    Type Name Description
    string name

    The name of the variable to be removed.

    Returns
    Type Description
    bool

    true if a variable with the specified name was removed, false if one was not.

    Examples

    This example shows how to remove a local variable.

    const string variableName = "my-variable";
    
    localizedString.Add(variableName, new FloatVariable { Value = 100.45f });
    Debug.LogFormat("Contains variable before remove: {0}", localizedString.ContainsKey(variableName));
    
    localizedString.Remove(variableName);
    Debug.LogFormat("Contains variable after remove: {0}", localizedString.ContainsKey(variableName));

    Remove(KeyValuePair<string, IVariable>)

    Removes a local variable with the specified key.

    Declaration
    public bool Remove(KeyValuePair<string, IVariable> item)
    Parameters
    Type Name Description
    KeyValuePair<string, IVariable> item

    The item to be removed, only the Key field will be considered.

    Returns
    Type Description
    bool

    true if a variable with the specified name was removed, false if one was not.

    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)