Skip to content

Commit 02b4b83

Browse files
authored
Update Readme.md
1 parent 417ae60 commit 02b4b83

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11

22
# Type Object
33

4+
## Definition
5+
6+
"Define a type object class and a typed object class. Each type object instance represents a different logical type. Each typed object stores a reference to the type object that describes its type."
7+
8+
## When use it
9+
10+
1. You don’t know what types you will need up front
11+
2. You want to be able to modify or add new types without having to recompile or change code.
12+
13+
### Notes
14+
- You move the Type from Code to Data. The flexibility is good, but you lose some things by hoisting your types into data.
15+
- We need to make sure the Types are loaded in memory because they are now objects, and not part of the language done in compilation time.
16+
- It is much more complex to add new behaviors to specific Types because we don't have code (this point not valid for Scriptable Objects).
417

518
References:
6-
1. Book [Game Programmings Patterns](https://gameprogrammingpatterns.com/subclass-sandbox.html)
7-
2. Github [Qian Mo](https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/SubclassSandbox%20Pattern)
8-
3. Article [Habrador](https://www.habrador.com/tutorials/programming-patterns/11-subclass-sandbox-pattern/)
19+
1. Book [Game Programmings Patterns](https://gameprogrammingpatterns.com/type-object.html)
20+
2. Github [Qian Mo](https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Type%20Object%20Pattern)

0 commit comments

Comments
 (0)