Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question Ghost weapon best practice

Discussion in 'NetCode for ECS' started by Asoprachev, Oct 6, 2023.

  1. Asoprachev

    Asoprachev

    Joined:
    Aug 13, 2017
    Posts:
    9
    GhostAuthoring.GhostGroup tooltip says that it's useful for weapon pickup system, when weapon is another Ghost, but In all examples, weapon is just component on Player Ghost entity. Which best practice to create switchable weapon in netcode project?
    a. Player is a ghost and each weapon is another ghost, linked by Ghost Group
    b. Player is a ghost and weapon state is component on it, for example with synced enum of weapon type
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    313
    Hey Asoprachev!

    Unfortunately, this is not a question we can answer, as it depends upon your game design. If you have a use-case where weapons are "first class" ghosts, then you would likely have some kind of item management system built in Entities, allowing users to pickup and drop items, including weapon ghosts.

    Other games load all weapons into the character controller's hands, and simply enable the one the player is holding (usually for RAM and animation simplification reasons).