Skip to main content

IUserDetailProvider

Provides user-specific data and operations within the game environment. This interface inherits from IOrchestratorService and acts as a bridge between the orchestrator and user profile management.

public interface IUserDetailProvider : IOrchestratorService

🔑 Properties​

Action<MyUserProfile> OnUserDetailsChanged​

Callback invoked when the local user's profile details are updated.

MyUserProfile : MyUserProfile​

Synchronous access to the current user's profile.

GameEnvironment GameEnvironment { get; set; }​

The game environment context, potentially used for routing or determining environment-specific behavior.


📦 Methods​

Task<T> GetUserProfile<T>(string userID) where T : UserProfile​

Fetches a user profile of type T for a given user ID.

Task<UserProfile> GetMyUserProfile()​

Asynchronously fetches the current user's profile from a remote source.

void StopUserSubscription()​

Unsubscribes from any ongoing user profile update subscriptions.

void SubscribeToUserDetails<T>(Action<T> callback) where T : UserProfile​

Subscribes to changes in the user profile and invokes the provided callback when updates occur.

Task<UserProfile> UpdateDisplayName(string displayName)​

Updates the current user's display name and returns the updated profile.

Task<bool> Initialize(GameOrchestrator orchestrator)​

Initializes the provider with a reference to the current orchestrator.


  • UserProfile: Base class for user data.
  • MyUserProfile: Likely a subclass with local-specific fields.
  • GameOrchestrator: The controlling orchestrator instance managing global state.

✅ Example Usage​

await userDetailProvider.Initialize(orchestrator);
var profile = await userDetailProvider.GetMyUserProfile();
userDetailProvider.OnUserDetailsChanged += profile => Debug.Log(profile.displayName);

Use this interface to manage player-specific identity, UI updates, and game logic triggered by user metadata.