Building Placer

You can find all the information about Building Placer here.

Manages all aspects of building modes (Placement, Destruction, Edition).

Include three Build Modes

  • Placement Mode allows you to preview a Building Part to place it.

  • Destruction Mode allows you to preview a Building Part already placed to destroy it.

  • Edition Mode allows you to preview a Building Part already placed to move it elsewhere.

A Input Handler component is required to know which actions to trigger according to user inputs.

By default the system uses the Standalone Input Handler to handle user inputs. It allows you to manage the selection of build modes and of different Building Parts available in the Building Manager of the scene. You can change the Action's key for each action directly in the inspector. This works also with the new Unity Input System.

If you want to use the system for Android platforms. You can use the Android Input Handler.

On platforms which require a gamepad. You can use the Gamepad Input Handler. You will need to use the new Unity Input System and import the support here.

This component must be attached to a camera with the tag "Main Camera". In the Raycast Settings section, you can choose the type of view according to your game view.

FIRST_PERSON_VIEW Cast a ray from the camera to forward direction.

THIRD_PERSON_VIEW Cast a ray from the character to forward direction.

TOP_DOWN_VIEW Cast a ray from the camera to world mouse position.

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:

using EasyBuildSystem.Features.Runtime.Buildings.Placer;

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

BuildingPlacer.Instance

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

Events

/// <summary>
/// Event that is triggered when the build mode is changed.
/// </summary>
BuildingPlacer.Instance.OnChangedBuildModeEvent.AddListener((BuildMode mode) => { });

/// <summary>
/// Event that is triggered when the Building Part selection is changed.
/// </summary>
BuildingPlacer.Instance.OnChangedBuildingPartEvent.AddListener((BuildingPart part) => { });

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

Last updated