You can find all the information about Building Manager here.
This component is the core of the system. It contains a Building Parts 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 Building Parts, as well as some optimization features such as Area Of Interest and Building Batching.
Optimization Features
Area Of Interest Disabling all Building Areas and Building Sockets 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: Tooltip Attribute.
API
You can access this class by including the following namespace:
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>/// <paramname="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>/// <paramname="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>/// <paramname="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>/// <paramname="buildingPart">The Building Part to place.</param>/// <paramname="position">The position to place the Building Part.</param>/// <paramname="rotation">The rotation of the Building Part.</param>/// <paramname="scale">The scale of the Building Part.</param>/// <paramname="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>/// <paramname="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.