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.

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,077
    @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:
      212
    Last edited: Apr 1, 2022
  2. optimise

    optimise

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

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,673
    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,673
    No, IStatefulSimulationEvent inherits from IBufferElementData
     
  6. adammpolak

    adammpolak

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