Custom Services

Overview

A Custom Service is a Java Object you write and configure to run within the Unity 2 Multiuser Server (U2MS) application. Because Custom Services are instantiatied by U2MS they have full access to the set of built in U2MS Services. Using a Custom Service the ability to create complex interactions with Unity become almost limitless.

Examples of Custom Services might be:

Creating A Custom Service

The Service Interface

The interface contains two methods. The first load() is called when Unity is started up. The attributes as set in uconfig.xml are passed as an argument. Any initialization should be performed in load(). The second unload is called when Unity is shutdown. Any cleanup of resources should be performed in unload().

Accessing the Service from within Unity

You can access the Service from within Unity via the Services Object. For example,

Service service = Services.getCustomService("EmailService");

Once you've obtained a reference to the Service you can cast it to the actual known type to access any custom methods within the Class.

See org.moock.unity.examples.rooms.CustomServicesAccess in the ./examples/rooms/ directory for an example.