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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug Cannot implement Buffer,Buffer interfaces at the same time

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

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    1,526
    @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:
      136
    Last edited: Apr 1, 2022
  2. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    1,526
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,414
    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.
     
    Radivarig, Occuros and optimise like this.
  4. adammpolak

    adammpolak

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

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,414
    No, IStatefulSimulationEvent inherits from IBufferElementData
     
  6. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    447
    Thank you!
     
unityunity