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

Importing numpy crashes Py.GIL()

Discussion in 'Formats & External Tools Previews' started by TrashestCoder, Jan 12, 2022.

  1. TrashestCoder

    TrashestCoder

    Joined:
    Jan 27, 2017
    Posts:
    14
    If you import numpy into default PySideExample.py code and run it in the play mode, Unity, after entering play mode for the second time, crashes. Strangely numpy works just fine for the first time it enters playmode. Both times I call this script using Py.GIL(), just like in the example. Even after using an empty .py file, that only imports numpy, it still crashes exactly after second play mode.
    As it crashes unity temporarily throws this error:

    SerializationException: Type 'UnityEngine.UnityLogWriter' in Assembly 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

    Any suggestions how to fix this problem? Maybe it has to do with garbage collection?

    Edit: Found easier way to replicate this issue: Open unity python console and execute "import numpy". Then enter play mode and this issue repeats again
     
    Last edited: Jan 12, 2022
  2. Klanawohm

    Klanawohm

    Joined:
    Apr 29, 2022
    Posts:
    1
    I also have this problem,have you solved it?
     
  3. TrashestCoder

    TrashestCoder

    Joined:
    Jan 27, 2017
    Posts:
    14