Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug GhostComponentSerializer generates bad code when using assemblies

Discussion in 'NetCode for ECS' started by Jawsarn, Aug 8, 2021.

  1. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    258
    Code (CSharp):
    1. ComponentType = ComponentType.ReadWrite<ClientAndServer.GameplayAbilities.Core.GameplayAbilityTagData>(),
    2. ComponentSize = UnsafeUtility.SizeOf<ClientAndServer.GameplayAbilities.Core.GameplayAbilityTagData>(),
    is generated where it comes from assembly ClientAndServer which causes errors. It simply requires "
    using ClientAndServer.GameplayAbilities.Core;" which is generated, but then using

    Code (CSharp):
    1. ComponentType = ComponentType.ReadWrite<GameplayAbilityTagData>(),
    2. ComponentSize = UnsafeUtility.SizeOf<GameplayAbilityTagData>(),
     
  2. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    what kind of errors you are getting ?
    Having the class typename with namespaces looks correct to me in that case at a first glance
     
  3. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    258
     
  4. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    GameName.ClientAndServer..
    Looks to me we are extracting the wrong namespace somehow
     
  5. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    258
    I have a lack of knowledge in the area of assemblies. But since it works without namespaces infront of classname. It seems like referencing classes in other assemblies is not allowed with namespaces infront and requires the "using >namespace>" of package. Ghost component code is located in GameName.ClientAndServer.GameplayAbil.. and NetCodeGenerated gets wrapped into GameName.ClientAndServer.Generated. I probably have time to do a small example later today and post.
     
  6. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    258
    Ok, my bad. I didn't use the namespace of GameName.ClientAndServer.GameplayAbilities.Core for GameplayAbilityTagData but only ClientAndServer.GameplayAbilities.Core . Not sure if that should be generated successfully anyway.