Search Issue Tracker

Active

Under Consideration for 2021.3.X, 2022.3.X, 6000.0.X

Votes

10

Found in

2021.3.42f1

2022.3.41f1

6000.0.14f1

7000.0.0a1

Issue ID

UUM-77728

Regression

No

Crash on UnityMain when opening the Player after building it

--

-

Reproduction steps:
1. Open the attached “repro-project“
2. Open the “Assets/SampleScene.unity“ scene
3. Build And Run
4. Observe the Player crashing

Reproducible with: 2021.3.42f1, 2022.3.41f1, 6000.0.14f1

Reproduced on: Windows 10
Not reproducible on: No other environment tested

Note: Player logs mention a corrupted file: "The file 'C:/Users/<…>/UnityProjects/My project (4)/New folder/My project (4)_Data/level0' is corrupted! Remove it and launch unity again! [Position out of bounds!]"

Comments (2)

  1. vangogih

    Aug 07, 2024 13:10

    Some extra details from my side.

    Unity crashes only when you try to Instantiate an object with problem script. If you will add this component via AddComponent<T> the crash won't appear.
    Providing prefab with component and loading it from Resources also trigger the crash.

    After importing project to VS and run I got the stacktrace, I hope it helps:
    UnityPlayer.dll!DebugStringToFilePostprocessedStacktrace(struct DebugStringToFileData const &)
    UnityPlayer.dll!DebugStringToFile(struct DebugStringToFileData const &)
    UnityPlayer.dll!CachedReader::OutOfBoundsError(unsigned __int64,unsigned __int64)
    UnityPlayer.dll!CachedReader::UpdateReadCache(void *,unsigned __int64)
    UnityPlayer.dll!StreamedBinaryRead::TransferSTLStyleArray<struct ArrayOfManagedObjectsTransferer>(struct ArrayOfManagedObjectsTransferer &,enum TransferMetaFlags)
    UnityPlayer.dll!Transfer_ManagedObject<StreamedBinaryRead,1>()
    UnityPlayer.dll!TransferField_LinearCollection<class SafeBinaryRead>(struct SerializationCommandArguments const &,struct RuntimeSerializationCommandInfo &)
    UnityPlayer.dll!ExecuteSerializationCommands<class ConfigSettingsRead>(struct dynamic_array<struct SerializationCommand,0> const &,class ConfigSettingsRead &,class GeneralMonoObject const &)
    UnityPlayer.dll!TransferScriptingObject<class StreamedBinaryRead>(class StreamedBinaryRead &,class ScriptingObjectPtr,class ScriptingClassPtr,struct SerializationCache::Data * &)
    UnityPlayer.dll!TransferScriptingObject<class StreamedBinaryRead>(class StreamedBinaryRead &,class ScriptingObjectPtr,class ScriptingClassPtr,struct MonoScriptCache const *)
    UnityPlayer.dll!SerializableManagedRefTransfer::TransferScriptingObjectWithSerializedRefSupport<class StreamedBinaryRead>(class Object *,class SerializableManagedRef &,class StreamedBinaryRead &)
    UnityPlayer.dll!SerializableManagedRefTransfer::Transfer(class Object *,class SerializableManagedRef &,class StreamedBinaryRead &,bool)
    UnityPlayer.dll!MonoBehaviour::VirtualRedirectTransfer(class StreamedBinaryRead &)
    UnityPlayer.dll!SerializedFile::ReadObject(__int64,enum ObjectCreationMode,bool,class TypeTree const * *,bool *,class Object &,class CacheReaderBase *)
    UnityPlayer.dll!SerializedFile::ReadObject(__int64,enum ObjectCreationMode,bool,class TypeTree const * *,bool *,class Object &)
    UnityPlayer.dll!PersistentManager::ReadAndActivateObjectThreaded(int,struct SerializedObjectIdentifier const &,class SerializedFile *,bool,bool,enum PersistentManager::LockFlags)
    UnityPlayer.dll!PersistentManager::LoadFileCompletelyThreaded(class core::basic_string_ref<char>,__int64 *,int *,int,enum PersistentManager::LoadFlags,class LoadProgress &,enum PersistentManager::LockFlags)
    UnityPlayer.dll!LoadSceneOperation::Perform(void)
    UnityPlayer.dll!PreloadManager::ProcessSingleOperation(void)
    UnityPlayer.dll!PreloadManager::Run(void)
    UnityPlayer.dll!PreloadManager::Run(void *)
    UnityPlayer.dll!Thread::RunThreadWrapper(void *)
    kernel32.dll!BaseThreadInitThunk()
    ntdll.dll!RtlUserThreadStart()

  2. AlexVanovix

    Aug 07, 2024 10:30

    I need to clarify some additional points about the bug that were not included in the description (the information was mentioned but got lost after testers reviewed it):

    1. The bug only manifested itself when the namespace of the class with [Serializable] attribute included System. That is, if the namespace was structured like this: namespace System.AnyNameSpace {}

    2. This issue occurred only if a class within that namespace was used in a List<MyAnySubSystemNamespaceConcreteClass> SerializableField. In our case, this was a ScriptableObject that used one of such lists.

    3. Unity worked perfectly in the Editor, loading all necessary information from the SO. However, once the application was built, it crashed immediately.

    4. You can find a project example with instructions here: https://github.com/AlexVanovix/serializationissuedemo. The instructions for running and reproducing the error are also provided there.

    5. The bug was found in version 2022.3.38f1, but Unity team`s testers were able to reproduce it in other LTS versions as well.

    6. Rider 2023.3.4 was used as the IDE, which did not highlight any code issue. We did not check for warnings in Visual Studio.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.