BuildModeOwnershipProvider
An implementation of OwnershipProvider that determines and manages player ownership of an interior for Build Mode interactions. This class synchronizes ownership data across clients and integrates with the dependency injection system via ISelfRegisteredInjectionTarget.
public class BuildModeOwnershipProvider : OwnershipProvider, ISelfRegisteredInjectionTarget
π§© Purposeβ
This provider:
- Tracks owner user IDs of an interior.
- Validates player access for Build Mode features.
- Uses RPC to synchronize ownership status to non-authoritative clients.
- Integrates with a
GameServiceFactoryto pull ownership data.
ποΈ Key Propertiesβ
ownerUserIDsβ
Type: List<string>
Description: User IDs permitted to interact with this interior.
interiorIDβ
Type: string
Description: The identifier for the specific interior being validated.
doIHaveOwnershipβ
Type: bool
Description: Cached client-side flag indicating local ownership status.
π§ Core Methodsβ
SetInteriorID(string intID)β
Sets the interior ID and fetches the associated owners.
CheckOwnership(PlayerActor actor)β
Validates ownership:
- On server: checks
ownerUserIDsdirectly. - On client: returns the locally cached
doIHaveOwnership.
RegisterOwner(string interiorID, string userID)β
Fetches current owners and confirms if the given user ID is included.
π Ownership Synchronizationβ
RequestOwnershipDetails_Rpc(string userID)β
Client β Server request to check if the user owns the current interior.
InformOfOwnershipStatus_Rpc(PlayerRef player, bool status)β
Server β Client response to cache the ownership result.
NotifyOfDataUpdate_Rpc()β
Triggers ownership refresh on all proxies (clients).
π§ͺ Initializationβ
Awake()β
Performs injection setup for ISelfRegisteredInjectionTarget.
InjectionCompleted()β
Empty placeholder to satisfy interfaceβready for post-injection logic if needed.
π Dependenciesβ
GameServiceFactory(Injected)IGameDataProvider.CheckOwnershipOfInterior(): Resolves owner user listInjector: Handles auto-registration for injection targets
β Usage Summaryβ
Attach this to any interior GameObject that needs to restrict Build Mode actions by ownership. It handles server-authoritative checks and synchronizes results to clients efficiently via RPC.
Use in conjunction with:
PlayerInteractionPointOwnershipProviderGameOrchestrator