{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method CreateSlice | App UI | 0.6.5
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method CreateSlice

    CreateSlice<TState>(string, TState, Action<SliceReducerSwitchBuilder<TState>>, Action<ReducerSwitchBuilder<TState>>)

    Create a new state slice. A state slice is a part of the state tree. You can provide reducers that will "own" the state slice at the same time.

    Declaration
    public Slice<TState> CreateSlice<TState>(string name, TState initialState, Action<SliceReducerSwitchBuilder<TState>> reducers, Action<ReducerSwitchBuilder<TState>> extraReducers = null)
    Parameters
    Type Name Description
    string name

    The name of the state slice.

    TState initialState

    The initial state of the state slice.

    Action<SliceReducerSwitchBuilder<TState>> reducers

    The reducers that will "own" the state slice.

    Action<ReducerSwitchBuilder<TState>> extraReducers

    The reducers that will be called if the action type does not match any of the main reducers.

    Returns
    Type Description
    Slice<TState>

    A slice object that can be used to access the state slice.

    Type Parameters
    Name Description
    TState

    The type of the state.

    Remarks

    You can also provide extra reducers that will be called if the action type does not match any of the main reducers.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the state slice already exists.

    In This Article
    Back to top
    Copyright © 2023 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)