Implementing a Command Design Pattern in Unity

In this tutorial, we will learn about Command Design Pattern and then implement a Command Design Pattern in Unity to solve the movement of a game object.
Read also: What Are C# Delegates And How To Use Them
Read also: Solving the 8 puzzle problem using A* (star) algorithm
Introducing the Command Design Pattern
Requests, Orders and Commands: We are all familiar with them in
real life; one person sends a request (or an order or a command) to another
person to perform (or do not perform) some tasks that are assigned to
them. In software development and programming,
this thing works in a similar way: one component’s request is transmitted to
another to execute specific tasks in the Command pattern.
Definition: A command pattern is a behavioural design pattern
in which a request is transformed into an object that encapsulates (contains) all information needed to perform an action or trigger an event at a later time. This
transformation into objects lets you parameterize methods with different
requests, delay a request and/or queue the request’s execution.
Good and robust software design should be based on the principle of separation of concerns. This can usually be achieved by breaking up the application into multiple layers (or software components). A commonly recurring example is dividing an application into a graphical user interface that handles only the graphics part and another into logic handler for the business logic part.
The GUI layer is responsible for rendering a beautiful picture on the screen and capturing any inputs, where the logic handler could be to perform actual calculations for a specific task. The GUI layer thus delegates the work to the underlying layer of business logic.
Read the post on Faramira.