Unity Redux

1 min. read

Introduction

Redux is an excellent patterns which solves many issues we have had with development, maintenance, testing, scaling, etc..

Use our DLL (XGameDev.Redux)
Import the DLL (Plugins/XGameDev)
Start with a wireframe of the application
Create actions based on the wireframe
Create an initial state of the Store (initialState.json)
Use namespaces

Actions

States
All data goes here

State should be read only

Split the state based on:
Domain data
App state
UI state

Reducers
All the logic goes here.

it’s just a function that takes state and action as arguments, and returns the next state of the app
Action type based reducers
Each action type should have its own reducer.

Views
Main View
BaseTextView
Needs to be created in each project, or is recommended to do so, it cant be added to the dll as that would cause the DLL to be coupled with Utilities.

Container
A container script will setup the Store with Reducer, View and State

Action Creators
Init
This script just takes the JSON file and creates an init Action, which will setup the state

BaseListener