Search Unity

Feature Request Completely strip art assets from SubScene from server build feature

Discussion in 'NetCode for ECS' started by optimise, Jul 19, 2021.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni Currently SubScene will build everything into the server build even u don't need it. For server build there's no need to include art assets to reduce lots of server build size. My current use case is I have environment subscene that I want to completely strip art assets out from server build. The feature is similar to GhostAuthoringComponent monobehavior that able to choose the component you want to strip but now I want able to strip environment that is not ghost.
     
    desertGhost_ likes this.
  2. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    It is not fully supported right now.
    You can definitely removed/strip components during conversion on any ghost by just adding a GhostComponentAttribute to any class / struct (even if it does not need to be serialized). For components you don't own (like MeshRenderer for example) you can do the same by using the IGhostComponentOverride interface.

    For stripping the geometry things are a little more complex.
    You can try doing that by adding a GameObjectConversion systems that run in the PostConversion group. Here you can remove the MeshRenderer or other components and you may free the references to the blob assets as well.
    Alternatively, you can modify the conversion for the MeshRenderer (for example) such that it check what type of build it is and avoid exporting / converting the data.
     
    Opeth001 likes this.
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni Is there any plan to make it able to remove/strip components for client and server not just for ghost entity but for all non-ghost entity too? When this feature available, I guess it will possible to achieve stripping art asset from server build since RenderMesh component has been removed/strip? Btw currently for ghost entity it should completely strip art asset on server when untick RenderMesh component right?
     
  4. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    There is a plan to avoid converting subscene entirely for client and server and let you skip/avoid converting components as well.
    If I remember correctly you should already be able to strip the RenderMersh and other components from ghost for sure by using the IGhostDefaultOverrides. We also provide a way to avoid excluding assembly for running during conversion, effectively stripping all the entities generated by these systems, using Build Configuration (ex: on the server you can exclude the hybrid renderer assemblies and nothing will be generated and as such also no dependencies included)
     
    Opeth001 likes this.