Unity C# - Service Locator Design Pattern - 2024 Solution

Описание к видео Unity C# - Service Locator Design Pattern - 2024 Solution

In this video, I'm going to show a service locator system that I made to be used in Unity projects. It's a very useful design pattern, but as with any other pattern, it must be used carefully. In this video, I demonstrate a use case for a PlayerTransformService, I found really useful to track some information about the Player transform. It can be used for AI or some other systems like interaction when you need for example, to know the Player forward vector to play a door animation to the correct side. You don't need a direct reference to the player game object on each door to get the transform, you can get it via service locator and use the information that you need to perform your action. 

If you have any questions or suggestions, just drop a comment down below.

You can get the package and source code files here: https://github.com/Lasanha-Dev/Unity-...

00:00 Demonstration

03:15 PlayerTransformService

06:00 Service Client (PlayerFollower)

08:00 ServiceAvailabilityStatus

08:08 IService

08:20 GameServiceLocator

13:10 ServiceDefinition

14:40 Outro

Комментарии

Информация по комментариям в разработке