World Builder – Reference Provider

Overview #

The IReferenceProvider interface is a central component in the WorldBuilder plugin system. It serves as a comprehensive provider for various systems, services, UI components, and tools that are necessary for extending the WorldBuilder-base application. This interface allows access to settings, localization, asset management, UI elements, and other core systems that are usefull.

The IReferenceProvider interface aggregates a range of essential functionalities including asset importing, project and location loading, UI management, and camera control, enabling other systems or plugins to interact with these resources efficiently.

Properties and Events #

Events #

  • OnProjectLoaded:
    Triggered when a project has been loaded into the system. This event provides the IProject instance representing the loaded project.
  • OnLocationLoaded:
    Triggered when a location (a scene or level) is loaded. This event provides the ILocation instance representing the loaded location.

General Properties #

  • LoadProcessHooks:
    Provides hooks for the loading process, allowing custom actions or extensions to be triggered during project or location loading.
  • SaveProcessHooks:
    Provides hooks for the saving process, allowing custom actions or extensions during project or location saving.
  • BuilderSettings:
    Access to the BuilderSettings, which stores and manages user preferences, configuration settings, and builder-related configurations.
  • LocalizationSystem:
    Provides access to the ILocalizationSystem responsible for managing localization and language resources within the application.
  • GlobalParameters:
    Provides access to the IParameterSystem, which handles global parameters to allow accessing them in other plugins or as triggers in an event driven architecture.
  • PluginProvider:
    Provides access to the IPluginProvider, enabling interaction with installed plugins and their associated functionality.
  • AssetDatabase:
    Provides access to the IAssetDatabase, which manages the assets within the application, such as models, textures, and other resources.
  • AssetImporter:
    Provides access to the IAssetImporter, responsible for importing new assets into the project.
  • Project:
    The current project loaded into the system, represented by an IProject instance.
  • LoadedLocation:
    The currently loaded location (e.g., scene or level) represented by an ILocation instance.
  • HiddenVisualObjectsParent:
    A Transform that holds hidden visual objects in the scene, used for managing objects that should not be directly visible to the user.
  • MouseHandler:
    Access to the IMouseHandler, which handles mouse input and interactions within the World Builder.
  • WorldEditor:
    Provides access to the IWorldEditor, which is responsible for editing a location, such as translating, rotating an scaling of objects.
  • CommandMapper:
    Provides access to the ICommandMapper, a system that maps input commands to keyboard keys.
  • HopperReference:
    Provides access to the IHopperReference, it’s a reference provider for all Portal Hopper related functionality.
  • HopperParameters:
    A dictionary containing string key-value pairs representing parameters related to the Portal Hopper.
  • PlacingManager:
    Provides access to the IPlacingManager, responsible for managing the placement of objects within the world editor (e.g., placing buildings, characters, etc.).

UI Properties #

  • ThemeLoader:
    Provides access to the IUIThemeLoader, responsible for loading and managing UI themes.
  • ElementFactory:
    Provides access to the IUIElementFactory, which is responsible for creating UI elements dynamically.
  • IconProvider:
    Provides access to the IIconProvider, responsible for getting access to included icons.
  • ProgressScreen:
    Provides access to the IUIProgressScreen, which displays a progress screen to the user during lengthy operations (e.g., loading, saving, or exporting).
  • UIAnimator:
    Provides access to the IUIAnimator, responsible for animating UI elements, such as transitions or visual effects.
  • PopupSystem:
    Provides access to the IPopupSystem, responsible for displaying popup dialogs and notifications to the user.
  • MainMenu:
    Provides access to the IMenu representing the main menu UI.
  • SettingsMenu:
    Provides access to the ISubMenu for the settings UI, where users can adjust configuration options.
  • WorldMenu:
    Provides access to the ISubMenu for the world-specific settings and options menu.
  • StartUIRoot:
    A VisualElement that represents the root UI element for the start screen, the initial UI visible to the user when the application launches.
  • HUD_UIRoot:
    A VisualElement that represents the root UI element for the world builder after a world is loaded.
  • ReferenceResolution:
    A Vector2Int defining the reference resolution used for UI layout, ensuring consistency across different screen sizes and aspect ratios.
  • ProjectsScreenController:
    Provides access to the IUIProjectsScreenController, responsible for managing the UI and interactions related to the projects screen.
  • CreateProjectScreenController:
    Provides access to the IUICreateProjectScreenController, responsible for managing the UI and interactions related to the project creation screen.
  • AssetManagerController:
    Provides access to the IUIAssetManagerController, which controls the asset management UI.
  • ExportPageController:
    Provides access to the IUIExportPageController, which controls the UI for exporting the project or world.
  • InspectorController:
    Provides access to the IUIInspectorController, which handles the inspector UI for viewing and editing properties of selected objects.
  • AssetDataProvider:
    Provides access to the IUIAssetDataProvider, which provides data related to assets for use within the UI (e.g., displaying asset properties).
  • CursorController:
    Provides access to the ICursorController, which manages the cursor behavior.
  • CameraController:
    Provides access to the ICameraController, which manages the camera’s movement and positioning in the location view.
  • LocationViewToolbar:
    Provides access to the ILocationViewToolbar, a UI toolbar specific to managing views of the current location (scene or level).

Usage Example #

public class MyCustomPlugin : PluginBase
{
    // A method called when the plugin is initialized
    public override void CreateSetupProcess()
    {
        base.CreateSetupProcess();

        // Subscribe to project and location loading events
        ReferenceProvider.OnProjectLoaded += OnProjectLoaded;
        ReferenceProvider.OnLocationLoaded += OnLocationLoaded;
    }

    // Event handler for when a project is loaded
    private void OnProjectLoaded(IProject project)
    {
        Debug.Log($"Project Loaded: {project.Name}");
    }

    // Event handler for when a location is loaded
    private void OnLocationLoaded(ILocation location)
    {
        Debug.Log($"Location Loaded: {location.Name}");
    }
}

Conclusion #

The IReferenceProvider interface centralizes key systems, tools, and services required to build and manage worlds within the WorldBuilder environment. It simplifies interaction with various subsystems and provides structured access to the underlying functionality needed for tasks like asset management, project and location handling, UI management, and more.