Unit System
  • WELCOME
    • πŸ‘‹Hello
    • πŸ—ΊοΈRoadmap
    • ⛑️Support & Community
    • πŸŽ“Version - Changelog
  • Getting Started
    • πŸ”ŒImport Package
    • βš™οΈConfiguration
    • πŸ” Database
    • πŸͺŸManager Window
    • Creating a new Scene
      • Player Camera
      • Set up Player
      • Set up Player UI
      • Set up the Game World
    • Create Units
      • Resource (Crystal)
      • Research (Crystal age)
      • Resource node (Crystal Node)
      • Resource collector (Crystal)
      • Combat unit (Mage)
      • Production unit (Mage Tower)
      • Faction (Purple Cubes)
  • How it works
    • Overview
    • Modules
      • Resource
      • Production
      • Population
      • Garrison
      • Collection
  • Integration
    • Unit Selection
    • Unit Formation
    • Object Placement
Powered by GitBook
On this page
  • Overview
  • 1. Placement & Units
  • 2. Player placement
  • 3. Disable Selection
  1. Integration

Object Placement

Guide on how to integrate placing buildable units with Unit System demo scripts.

PreviousUnit Formation

Last updated 15 days ago

Overview

This page is for guiding you through the process of basic integration for package. Refer to the if you need more information.

1. Placement & Units

If you do not have Object Placement package present, then follow it's guide for import and scene setup:

  • Create empty object and add ObjectPlacement component to it. Check all the tabs and configure it for your project.

  • Units may use their colliders by default if one is present, otherwise follow to configure bounds for each units as well.

2. Player placement

Add EntityPlacementManager which will handle all the events for your and start object placement when a request is invoked. You can replace this script with custom event handling for the request.

Placements are requested by Production Module when production request is processed that requires building and therefore placement in the world.

if (player.TryGetModule(out ProductionModule module))
{
    module.OnStartPlacementRequest.AddListener(StartPlacement);
}

3. Disable Selection

While placing an object selection is still active and may interfere with placement by highlighting objects or even selecting them.

There are few ways to achieve this and here are two:

  • If you are using Unit Selection asset, then you may use the additional ActivePlacementSelectionToggler script which does only this, observe the placement events and enables/disables the UnitSelector.

  • For any integration you can always set up events of the EntityPlacementManager by yourself in code or directly in the scene.

Object Placement
Placement Guide
the guide
Active Placement Selection Toggler with Placement Manager
Configured events in Scene