Search Unity

Resolved Cannot implement Buffer,Buffer interfaces at the same time

Discussion in 'NetCode for ECS' started by optimise, Mar 31, 2022.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni @timjohansson I try to drop the 2 script files (see attached files) into dots netcode project I will get the following error. It seems like u will only get this error when u have dots netcode package. Any idea how to fix it?

    Edit: Seems like in dots netcode project, using generic type dynamic buffer will throw error. Can u point me which part of dots netcode code to fix it if it's possible?

    Microsoft (R) Visual C# Compiler version 3.8.0-dev.20527.1 (53dc6556)
    Copyright (C) Microsoft Corporation. All rights reserved.
    error NetCode: struct Unity.Physics.Stateful.StatefulCollisionEvent cannot implement Buffer,Buffer interfaces at the same time
    error NetCode: struct Unity.Physics.Stateful.StatefulTriggerEvent cannot implement Buffer,Buffer interfaces at the same time
     

    Attached Files:

    • 1.zip
      File size:
      1.6 KB
      Views:
      234
    Last edited: Apr 1, 2022
  2. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    I can repo the error but the fix is very easy as well.

    public struct StatefulCollisionEvent :IBufferElementData, IStatefulSimulationEvent<StatefulCollisionEvent>

    to

    public struct StatefulCollisionEvent : IStatefulSimulationEvent<StatefulCollisionEvent>

    Doesn't like implementing the same interface twice for some reason.
     
  4. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    Does this not cause any unexpected behavior?
     
  5. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    No, IStatefulSimulationEvent inherits from IBufferElementData
     
    UniqueCode likes this.
  6. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    Thank you!