Search Unity

Video Force VideoPlayer memory to be released?

Discussion in 'Audio & Video' started by distastee, Oct 2, 2019.

  1. distastee

    distastee

    Joined:
    Mar 25, 2014
    Posts:
    66
    Hello!
    I've got an ios app that will basically play an unlimited number of different videos. I run into a problem where, after X amount of videos, the app crashes due to lack of memory. I call this when switching videos:

    Code (CSharp):
    1.                 var _videoPlayer = gameObject.GetComponent<VideoPlayer>();
    2.                 _videoPlayer.Stop();
    3.                 Destroy(_videoPlayer);
    According to the documentation, I don't even need to call Destroy() as Stop() will release all the memory by itself. However this doesn't seem to be true, as every time I load a new video the memory usage goes up significantly. Does anyone know a good way to force this memory to be released? Thanks!
     
  2. Domas_L

    Domas_L

    Unity Technologies

    Joined:
    Nov 27, 2018
    Posts:
    111