Search Unity

If "Has Owner" is selected, does that mean the GhostOwnerComponent's NetworkId is automatically set?

Discussion in 'NetCode for ECS' started by adammpolak, May 30, 2022.

  1. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    If this component is added automatically to the prefab without needing another authoring component. Is its value also set by NetCode?
     
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    The network id value is *not* set, you must set that manually if you enable "has owner". If you do not you will get runtime warnings. We have no way of automatically figure out which connection owns a ghost you spawn in server code, that's why you need to set it yourself.
     
  3. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    Ah! Thank you for the clarification

    But if a client predicted spawned something (like a bullet that had "has owner" enabled) would the NetworkId automatically be set?
     
  4. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    No, predicted spawning is only on the client, the server does not know about the predicted spawn on the client and it does not change how the server spawns it - the client just tries to do the same thing the server will do to make it look like it has less latency.
     
    adammpolak likes this.