Expression Trees in Unity unlock powerful runtime flexibility, enabling dynamic systems like modding, runtime scripting, and data-driven AI—areas where static tools such as interfaces or dependency injection often fall short. By treating code as data, Expression Trees let you dynamically create, modify, and execute logic during gameplay. In this video, we’ll show you how to harness Expression Trees to build adaptive systems for game development.
Ever wondered how games like *The Sims, Spore, Creatures, and Black & White* handle the complexity of dynamic behaviors and runtime logic? Expression Trees make similar systems possible, enabling you to manage adaptability and player driven changes without the need to predefine countless interfaces, delegates or hardcode AI behaviors.
Read More: https://learn.microsoft.com/en-us/dotnet/csharp/advanced-topics/expression-trees/expression-trees-explained
https://tyrrrz.me/blog/expression-trees
Code Examples: https://gist.github.com/adammyhre/13c3685f48016e5b197322113082e418
Want to support me? 😀
Buy me a coffee! https://ko-fi.com/adammyhre
🔔 Subscribe for more Unity Tutorials https://youtube.com/@git-amend
Discord: https://discord.gg/FDRZGQBBUC
#unity3d #gamedev #indiedev
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:00 Property Getter
4:00 Method Invoker
6:20 Calculation Lambdas
7:56 Logic and Runtime State Machine
More Useful Code:
https://github.com/adammyhre?tab=repositories
Unity Utility Library: https://github.com/adammyhre/Unity-Utils
Lock Inspector Hotkey: https://gist.github.com/adammyhre/4754f731a93bf1cab0d1385ccfa23642
Assets Shown In This Video (Affiliate Links)
Many of the Tools and other Assets used on this Channel will be on SALE during BLACK FRIDAY
Black Friday Sale: https://assetstore.unity.com/?flashdeals=true&rows=96&aid=1101lw3sv
Logwin: https://assetstore.unity.com/packages/tools/utilities/logwin-log-debug-values-tracker-149558?aid=1101lw3sv
C# Eval: https://assetstore.unity.com/packages/tools/visual-scripting/c-eval-56706?aid=1101lw3sv
RPG Fantasy Characters: https://assetstore.unity.com/packages/3d/characters/humanoids/fantasy/rpg-fantasy-pack-47749?aid=1101lw3sv
Heroic Creatures: https://assetstore.unity.com/packages/3d/characters/creatures/heroic-fantasy-creatures-full-pack-volume-1-5730?aid=1101lw3sv
Dynamic Nature: https://assetstore.unity.com/packages/3d/vegetation/forest-environment-dynamic-nature-150668?aid=1101lw3sv
Beautify: https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/beautify-3-advanced-post-processing-233073?aid=1101lw3sv
Umbra Soft Shadows: https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/umbra-soft-shadows-better-directional-contact-shadows-for-urp-282485?aid=1101lw3sv
Cloud Shadows: https://assetstore.unity.com/packages/vfx/shaders/cloud-shadows-fx-267702?aid=1101lw3sv
Timeflow: https://assetstore.unity.com/packages/tools/animation/timeflow-animation-system-247895?aid=1101lw3sv
Hot Reload: https://assetstore.unity.com/packages/tools/utilities/hot-reload-edit-code-without-compiling-254358?aid=1101lw3sv
Hierarchy Icons: https://assetstore.unity.com/packages/tools/utilities/better-hierarchy-272963?aid=1101lw3sv
Better Transform: https://assetstore.unity.com/packages/tools/utilities/better-transform-size-notes-global-local-workspace-child-parent--276554?aid=1101lw3sv
Better Mesh Filter: https://assetstore.unity.com/packages/tools/utilities/better-mesh-filter-266489?aid=1101lw3sv
Editor Console Pro: https://assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889?aid=1101lw3sv
Any Object Finder: https://assetstore.unity.com/packages/tools/utilities/any-object-finder-286455?aid=1101lw3sv
*Follow me!*
https://linktr.ee/gitamend