Using Wave Services from Visual Editor.

In WaveEngine the use of Services can be very useful when developing your applications / games. And, as you can create and register your own services you can add cross-scene and global elements that provide useful logic, like score managers,  entry points to native libraries, and much more. However, until now, Visual Editor didn’t allow you to register your own services, so you had to do that from code. That could cause problems: Creating components that use custom services could be tricky to debug in our Visual Editor, or depending on your code, it may directly provoke malfunctions in your scene.

Luckily, WaveEngine 2.40 has introduced the possibility of registering and setting up your custom services, as well as some Wave Extension services.

Creating a new Service class.

Creating a new Service is almost exactly like in the previous version. The only difference is that you must make the class Serializable if you want to add it to the Visual Editor.

For example, we may want to create a new service called ScoreManager, so we may create this class in our project:

This simple service keeps the score and has the property indicating the points per score. Notice the [DataContract] and [DataMember] attributes to make it serializable.

Registering services in Editor

Adding your service from Visual Editor is quite simple, just go to Project Settings…  and click on the (new) Services area.


Once in the Services settings area, you can add and remove services by clicking on the  and  buttons.

By clicking on the  button, a dialog will appear showing the service to be registered.


In this class list you can see the ScoreManagerService class that we added before in our project. Clicking on the OK button will add the service to your project.

Additionally, you can select the service and set its configuration properties, in this case the PointsPerScore property.


Using Services from C#

The services added in the Visual Studio are stored in a new file with the .wgame extension in the same folder and with the same name as the .weproj file. This file will store all the project properties. For now it only stores the registered services, but in the future version, we are planning to add more and more settings there.

This file is automatically loaded in the Initialize method from the Game class in the new project template:

In that method you can see the following line:

Which loads the Game Info file (.wgame) and reads and registers the contained services.

Old Wave Versions

If you are migrating an old Wave Engine project to this version, you will need to manually add that Load method, as shown before.


Leave a Reply

Your email address will not be published. Required fields are marked *