Search Unity

The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it

Discussion in 'Unity Transport' started by pblpbl, Jun 5, 2022.

  1. pblpbl

    pblpbl

    Joined:
    Sep 1, 2019
    Posts:
    15
    Anyone know how to fix the error that occurs with the Unity Transport minimal client and server example?
    I tested what would happen if the serverbehaviour.cs script wasn't put onto a gameObject, and when we exit play mode, this error happens every time. The tutorial link is here
    https://docs-multiplayer.unity3d.com/transport/current/minimal-workflow

    upload_2022-6-5_2-19-7.png
     
    Last edited: Jun 5, 2022
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    Thanks for the report!

    Seems like the native list holding the connections doesn't like being disposed of if it hasn't been created yet. I'll poke the collections developers to see whether that's expected or not. In the meantime, you should be able to get rid of the error by checking if the native list is created before disposing of it:
    Code (CSharp):
    1. public void OnDestroy()
    2. {
    3.     m_Driver.Dispose();
    4.     if (m_Connections.IsCreated)
    5.         m_Connections.Dispose();
    6. }
    I'll submit an edit to the documentation team.
     
    andylewisart and pblpbl like this.