Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question pre-65: CompanionLink is now internal?

Discussion in 'NetCode for ECS' started by Richay, Mar 23, 2023.

  1. Richay

    Richay

    Joined:
    Aug 5, 2013
    Posts:
    75
    I was using the CompanionLink managed component to sync a presentation gameobject with a ghost, but in pre-65 this class is now marked as internal.

    Is there another recommended way of managing this?
     
  2. Fabrice_Lete

    Fabrice_Lete

    Unity Technologies

    Joined:
    May 5, 2018
    Posts:
    47
    CompanionLink synchronizes the transform from the entity to the GameObject, and it also manages the lifetime of the GameObject. That second part is the main reason why it’s been made internal, it can only work reliably for a handful of use cases.
    Which means that as long as you aren’t looking for a generic solution, you should be able to write a custom equivalent to CompanionLink for your own specific use case without too much trouble. The implementation is still part of the package, just copy the bits you need into your project.
     
  3. Richay

    Richay

    Joined:
    Aug 5, 2013
    Posts:
    75
    Thanks Fabrice, it's irritating because CompanionLink worked perfectly for my use case, but as you said I've since copied it and all is okay.