In this tutorial we will learn about the ServiceLocator pattern. There are many ways to implement it but I find this particular one the most extensible and easy to use. I hope you enjoy the video.
The code can be found here:
https://github.com/x1r15/ServiceLocator
(Expect some minor changes & documentation updates)
This code relies heavily on some concepts we covered in other videos those are:
• How to make Unity better using Extens... - extension methods
• Unity Scripting: Improve Productivity... - attributes
• What is Generics and how to use it in... - generics
#Unity #Coding #ServiceLocator
00:00 Why do we need ServiceLocator?
00:40 Where to find the code and how to use the repository
01:33 General idea of ServiceLocator
04:31 Safe Register()
05:26 Forced Get()
09:55 Why generics?
15:59 Control what you can register
17:29 Renaming GameObjects for lazy people
19:05 How to never forget to register service
23:12 AutoRegistration technicalities
Смотрите видео How to create and use Service Locator in Unity онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал PitiIT 07 Апрель 2022. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 3,926 раз и оно понравилось 129 посетителям.