Easy Build System
Asset StoreSupportTwitterDiscord
  • Introduction
  • Getting Started
    • Getting Started
    • Common Issues
  • Tutorials
    • Beginners Guides
      • Modular Building Guide
      • Upgrading Guide
    • Advanced Guides
  • Components
    • Building Area
    • Building Group
    • Building Manager
      • Building Collection
      • Building Saver
    • Building Part
      • Building Conditions
    • Building Placer
      • Editor Building Placer
    • Building Socket
    • Building Linkable Surface
  • Integrations
    • Game Creator 2
      • Game Creator 2 - Inventory
    • Game Kit Controller
    • PlayMaker
    • PUN 2
    • Mirror
    • Fish-Net
    • RPG Builder
    • uSurvival
    • Rewired
  • Supports
    • XR Interaction Toolkit Support
  • Addons
    • Advanced Buildings
    • Buggy Constructor
    • Circular Building Menu
    • House Buildings
    • Survival Buildings
  • Annex
    • Compatibility
    • Refund Policy
Powered by GitBook
On this page

Was this helpful?

  1. Components

Building Manager

You can find all the information about Building Manager here.

PreviousBuilding GroupNextBuilding Collection

Last updated 1 year ago

Was this helpful?

This component is the core of the system. It contains a reference list and keeps in cache all the components related to the system in the scene during runtime.

It includes a list of Building Types used to define the type of , as well as some optimization features such as Area Of Interest and Building Batching.

Optimization Features

  • Area Of Interest Disabling all and that are far from the camera to prevent reaching the colliders limit in your scene. "PhysX engine used by Unity only handles a maximum of 65536 colliders in a scene."

  • Building Batching Reduce thousands of drawcalls into one call and increase performance significantly.

Explore fields description in the Inspector by hovering your cursor over them. You can find more information about this here: .


API

You can access this class by including the following namespace:

using EasyBuildSystem.Features.Runtime.Buildings.Manager;

This class inherits from Singleton class and can be called like this:

BuildingManager.Instance

Here is a list of all the events and methods of this component that can be called:

Events

/// <summary>
/// Event triggered when a Building Part is being placed.
/// </summary>
BuildingManager.Instance.OnPlacingBuildingPartEvent.AddListener((BuildingPart part) => { });

/// <summary>
/// Event triggered when a Building Part is being destroyed.
/// </summary>
BuildingManager.Instance.OnDestroyingBuildingPartEvent.AddListener((BuildingPart part) => { });

/// <summary>
/// Event triggered when a Building Area is registered.
/// </summary>
BuildingManager.Instance.OnRegisterBuildingAreaEvent.AddListener((BuildingArea area) => { });

/// <summary>
/// Event triggered when a Building Area is unregistered.
/// </summary>
BuildingManager.Instance.OnUnregisterBuildingAreaEvent.AddListener((BuildingArea area) => { });

/// <summary>
/// Event triggered when a Building Part is registered.
/// </summary>
BuildingManager.Instance.OnRegisterBuildingPartEvent.AddListener((BuildingPart part) => { });

/// <summary>
/// Event triggered when a Building Part is unregistered.
/// </summary>
BuildingManager.Instance.OnUnregisterBuildingPartEvent.AddListener((BuildingPart part) => { });

/// <summary>
/// Event triggered when a Building Socket is registered.
/// </summary>
BuildingManager.Instance.OnRegisterBuildingSocketEvent.AddListener((BuildingSocket socket) => { });

/// <summary>
/// Event triggered when a Building Socket is unregistered.
/// </summary>
BuildingManager.Instance.OnUnregisterBuildingSocketEvent.AddListener((BuildingSocket socket) => { });

/// <summary>
/// Event triggered when a Building Group is registered.
/// </summary>
BuildingManager.Instance.OnRegisterBuildingGroupEvent.AddListener((BuildingGroup group) => { });

/// <summary>
/// Event triggered when a Building Group is unregistered.
/// </summary>
BuildingManager.Instance.OnUnregisterBuildingGroupEvent.AddListener((BuildingGroup group) => { });

Methods

/// <summary>
/// Retrieves the closest Building Area to the specified position.
/// </summary>
/// <param name="position">The position to find the closest Building Area from.</param>
/// <returns>The closest Building Area to the specified position, or null if no active Building Areas are found.</returns>
BuildingArea closestArea = BuildingManager.Instance.GetClosestBuildingArea(Vector3 position);

/// <summary>
/// Gets the closest Building Group to the specified Building Part.
/// </summary>
/// <param name="buildingPart">The Building Part to find the closest Building Group from.</param>
/// <returns>The closest Building Group to the specified Building Part, or null if not found.</returns>
BuildingGroup closestGroup = BuildingManager.Instance.GetClosestBuildingGroup(BuildingPart part).

/// <summary>
/// Gets a Building Part by its identifier.
/// </summary>
/// <param name="identifier">The identifier of the Building Part to retrieve.</param>
/// <returns>The Building Part with the specified identifier, or null if not found.</returns>
BuildingPart partReference = BuildingManager.Instance.GetBuildingPartByIdentifier(string identifier);

/// <summary>
/// Places a new Building Part.
/// </summary>
/// <param name="buildingPart">The Building Part to place.</param>
/// <param name="position">The position to place the Building Part.</param>
/// <param name="rotation">The rotation of the Building Part.</param>
/// <param name="scale">The scale of the Building Part.</param>
/// <param name="createNewGroup">Whether to create a new Building Group for the Building Part (default: true).</param>
/// <returns>The placed Building Part.</returns>
BuildingPart placedPart = BuildingManager.Instance.PlaceBuildingPart(BuildingPart part, Vector3 position, Vector3 rotation, Vector3 scale);

/// <summary>
/// Destroys a Building Part.
/// </summary>
/// <param name="buildingPart">The Building Part to destroy.</param>
BuildingManager.Instance.DestroyBuildingPart(BuildingPart part);

All of the methods related to this component can be found in the file "BuildingManager.cs". If you have any specific questions about the API, feel free to contact us.

Building Parts
Building Parts
Building Areas
Building Sockets
Tooltip Attribute