Skip to main content

Interface IDataAnalysisService

Defines a game service responsible for managing subscriptions to gameplay data collectors for analysis purposes.

public interface IDataAnalysisService : IUnityGameService

Implements​

IUnityGameService

Examples​

Subscription is handled automatically by DataCollector in its Start and OnDestroy callbacks — actors do not need to call these methods directly. The pattern below shows how a custom loggable actor would wire up if it owned its own collector lifetime instead of relying on DataCollector:

// A custom actor that manages its own DataCollector subscription lifetime.
public class CustomActor : MonoBehaviour
{
[SerializeField] private DataCollector _collector;

private void OnEnable()
{
if (UnityServiceLocator.Current.TryGet(out var service))
service.SubscribeForAnalysis(_collector);
}

private void OnDisable()
{
if (UnityServiceLocator.Current.TryGet(out var service))
service.UnsubscribeFromAnalysis(_collector);
}
}
// In practice, prefer adding a DataCollector to the actor root — it calls
// SubscribeForAnalysis in Start and UnsubscribeFromAnalysis in OnDestroy automatically.

Methods​

SubscribeForAnalysis(DataCollector)​

Subscribes a data collector to the analysis system. Collected data will be gathered and processed by the analysis service.

void SubscribeForAnalysis(DataCollector collector)

Parameters​

NameTypeDescription
collectorDataCollectorThe data collector to subscribe.

UnsubscribeFromAnalysis(DataCollector)​

Unsubscribes a data collector from the analysis system. The collector will no longer provide data to the analysis service.

void UnsubscribeFromAnalysis(DataCollector collector)

Parameters​

NameTypeDescription
collectorDataCollectorThe data collector to unsubscribe.
  • Examples
  • Methods
    • SubscribeForAnalysis(DataCollector)
    • UnsubscribeFromAnalysis(DataCollector)