Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

stop movieTexture leads to game crash

Discussion in 'Scripting' started by pcharmoille, Jun 20, 2014.

  1. pcharmoille

    pcharmoille

    Joined:
    Jan 16, 2014
    Posts:
    15
    Hi everyone,

    code involved :
    Code (CSharp):
    1.  
    2.   try
    3.   {
    4.   if (movTex.isPlaying)
    5.   {
    6.   movTex.Stop();
    7.   videoRenderer.material.mainTexture = null;
    8.   videoRenderer.material.color = Color.white;
    9.   }
    10.   }
    11.  
    Context of the problem :

    I'm making a pinball game where the pinball and the board (scores and videos) are 2 differents unity applications dialing through RPC (.Net inter process communication).
    When the ball reaches an element it should load a video. On a specified event it should stop.

    Problem :

    Sometimes (very often) the game crashes on movtex.Stop() method when above code is reached through RPC.
    When it's reached through the board unity application there is no problem.

    Leads :

    I tried to commented the line and leave some unities command to make sure this is not main thread access problem which seems to be the case.

    stack trace :

    (0x011FD87B) (Board): (filename not available): AnimationEvent::Transfer<SafeBinaryRead> + 0x85d9b
    (0x011FC677) (Board): (filename not available): AnimationEvent::Transfer<SafeBinaryRead> + 0x84b97
    (0x011FC883) (Board): (filename not available): AnimationEvent::Transfer<SafeBinaryRead> + 0x84da3
    (0x011FCA00) (Board): (filename not available): AnimationEvent::Transfer<SafeBinaryRead> + 0x84f20
    (0x010E098B) (Board): (filename not available): Behaviour::Transfer<StreamedBinaryRead<0> > + 0xf4a3b
    (0x010E219B) (Board): (filename not available): Behaviour::Transfer<StreamedBinaryRead<0> > + 0xf624b
    (0x0132D398) (Board): (filename not available): AnimationEvent::Transfer<SafeBinaryRead> + 0x1b58b8
    (0x0135ED10) (Board): (filename not available): AnimationEvent::Transfer<SafeBinaryRead> + 0x1e7230
    (0x7688338A) (kernel32): (filename not available): BaseThreadInitThunk + 0x12
    (0x76F99F72) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x63
    (0x76F99F45) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x36

    Thanks for reading
     
    Last edited: Jun 20, 2014
  2. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    Please submit a bug report with this info and attach your project.
     
  3. pcharmoille

    pcharmoille

    Joined:
    Jan 16, 2014
    Posts:
    15
    solution :
    this is a thread issue. RPC methods are an callback thread so I had to queue on the main thread for the texture changes (I used loom : http://unitygems.com/threads/)

    It still doesn't explain why sometime it would work.

    Thanks for the care.
     
  4. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    If you think this is something that could be fixed on Unity's side, I still encourage you to submit a bug report.
     
  5. pcharmoille

    pcharmoille

    Joined:
    Jan 16, 2014
    Posts:
    15
    I did and put a link to this post inside. Hope this help.
     
  6. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    Yup, thank you!
     
  7. KpowKaEHoT

    KpowKaEHoT

    Joined:
    Dec 18, 2014
    Posts:
    3
    Is it fixed already?
    I have the same error, here is callstack from my output log:

    (0x0000000C) ((module-name not available)): (filename not available): (function-name not available) + 0x0
    (0x012E5A8B) (game_dev): (filename not available): Behaviour::Transfer<StreamedBinaryRead<0> > + 0x109e1b
    (0x012E7355) (game_dev): (filename not available): Behaviour::Transfer<StreamedBinaryRead<0> > + 0x10b6e5
    (0x0155A618) (game_dev): (filename not available): Object::Transfer<RemapPPtrTransfer> + 0x398f8
    (0x0158F4F0) (game_dev): (filename not available): Object::Transfer<RemapPPtrTransfer> + 0x6e7d0
    (0x758F919F) (KERNEL32): (filename not available): BaseThreadInitThunk + 0xe
    (0x77E90BBB) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x84
    (0x77E90B91) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x5a

    I'm taking it when use LoadLevelAdditive and both of my current level and new loaded has lot of MovieTextures. It crashes immediately after i call LoadLevelAdditive.
     
  8. pcharmoille

    pcharmoille

    Joined:
    Jan 16, 2014
    Posts:
    15
    It seems to be a thread related problem.
    In case you are dealing with threads you should know that Unity is single thread handled.
    Else I suggest you to open a new post on the forum and submit a new bug report