Write Dynamic Code Using Reflection || Unity, C# Tutorial

Publié le: 07 octobre 2024
sur la chaîne: Freedom Coding
1,526
65

Reflection is a really powerful programming tool, which can help you to write cleaner code and mainly can save you a lot of time. It can also be used for custom Unity editor tools and will make your code much more dynamic. When working with reflection, you are typically using the typeof keyword or the GetType() function to get the type of something, so you can then call functions on the type. In this tutorial, I prepared 4 examples of using reflection in Unity with C#. In the end, you will be able to dynamically instantiate any class, select types in the inspector, install plugins and call their private functions, and save or load data of any object with ease.

👍 Like and 🔔Subscribe for More Unity and C# Tutorials    / @freedomcoding  

Advanced service locator with contexts -   / 112983319  
Project files -   / 113461688  

🌟 Support My Work and Unlock Exclusive Content! 🌟
👉 Patreon:   / freedomcoding  

🎮 Join Our Developer Community!
💬 Discord:   / discord  

💖 Support Me Financially
☕ PayPal, Revolut: marek.freedom.coding@gmail.com

Website - https://www.freedom-coding.com

Timestamps:
00:00 What Is Reflection?
00:18 Dynamic vs Static Code
00:43 Basics of Reflection
01:37 Instantiating Classes Dynamically
07:32 Selecting Types In Inspector
14:03 Loading Plugins
15:25 Dynamic Save System
17:30 Conclusion


Sur cette page du site, vous pouvez voir la vidéo en ligne Write Dynamic Code Using Reflection || Unity, C# Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Freedom Coding 07 octobre 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,526 fois et il a aimé 65 téléspectateurs. Bon visionnage!