Search Issue Tracker

Not Reproducible

Votes

8

Found in

5.2.3f1

Issue ID

749522

Regression

No

[Build] HideFlags.DontSaveInBuild on MonoBehaviour causes crash

Deployment Management

-

Repro steps:
1) Open the project and the only scene in it
2) Build and run
3) Notice the player becomes not responsive
4) Select Main Camera in the Hierarchy
5) Click Toggle GameObject SaveInBuild button in the script component
6) Build and run - notice it works fine (just black window expected)

Comments (3)

  1. Rich-Skorski

    Oct 14, 2016 15:37

    I ran into this with an iOS build, and it had a similar stack to what DENIZPIRI posted, but there are two more calls ontop of HandleNotifications:

    IsSateMachineBehaviour
    ShouldRunBehaviour
    HandleNotifications

    I'd like to see this bug fixed because I think this flag is the only real way to make an editor only script. Most resources suggest using #if UNITY_EDITOR checks, which can remove most of the CPU overhead for the component, but I haven't found a way to remove the allocation of the component all together.

  2. DenizPiri

    Jun 29, 2016 11:31

    We experience the same issue in our project. Stack trace looks like this.

    ========== OUTPUTING STACK TRACE ==================

    0x0150779D (build) [c:\buildslave\unity\build\runtime\mono\monobehaviour.cpp:1189] MonoBehaviour::HandleNotifications
    0x0134109D (build) [c:\buildslave\unity\build\runtime\baseclasses\messagehandler.cpp:19] MessageForwarder::HandleMessage
    0x0133ADB3 (build) [c:\buildslave\unity\build\runtime\baseclasses\gameobject.cpp:1100] Unity::GameObject::SendMessageAny
    0x0158AC95 (build) [c:\buildslave\unity\build\runtime\misc\gameobjectutility.cpp:1071] SendMessageToEveryone
    0x015D28EA (build) [c:\buildslave\unity\build\runtime\preloadmanager\loadsceneoperation.cpp:465] LoadSceneOperation::PlayerLoadSceneFromThread
    0x015D2A2B (build) [c:\buildslave\unity\build\runtime\preloadmanager\loadsceneoperation.cpp:243] LoadSceneOperation::IntegrateMainThread
    0x015D07A2 (build) [c:\buildslave\unity\build\runtime\preloadmanager\preloadmanager.cpp:602] PreloadManager::UpdatePreloading
    0x01593475 (build) [c:\buildslave\unity\build\runtime\misc\player.cpp:1545] PlayerLoop
    0x0168B017 (build) [c:\buildslave\unity\build\platformdependent\winplayer\winmain.cpp:546] MainMessageLoop
    0x0168D2B4 (build) [c:\buildslave\unity\build\platformdependent\winplayer\winmain.cpp:969] PlayerWinMain
    0x01ACD5B8 (build) [c:\buildslave\unity\build\platformdependent\winplayer\shimmain.cpp:6] WinMain
    0x01B035D8 (build) [f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c:275] __tmainCRTStartup
    0x74F538F4 (KERNEL32) BaseThreadInitThunk
    0x77335DE3 (ntdll) RtlUnicodeStringToInteger

    ========== END OF STACKTRACE ===========

  3. XCompWiz

    Jun 22, 2016 09:11

    Using Unity 5.4.0b18.

    I also observe that the game will crash if any objects have a component on them with the DontSaveInBuild flag set as true. I have not checked if the object must be loaded or simply in the build.
    The player crashes with an Access Violation. This only happens in a built player, and not in the editor play mode. I can verify that this happens in Windows and Android builds.

    Conceivably, DontSaveInBuild would prevent the component from being in the build at all. Chances are it does but fails to inform the game object (or whatever manages loading the component) that the component does not exist, and so the initialization attempts to load the non-existent component.

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.