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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. 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

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:
    150
    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.
     
    pblpbl likes this.