Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by mr-sambarlow · Jan 12, 2015 at 09:14 AM · out of memory

Major Memory Problems with using Lots of Movie Textures in a Scene

Hi,

I have a project with 300 Movie Textures (each fairly small -- a few MB). In my scene I have an object with a script which has a MovieTexture[] array, so I can point to the different movie textures and then stick the correct one on a texture to play when I need to.

I've added about 200 of the 300 movies and Unity has started crashing -- to the point where I can't save the scene or click around without getting a memory related crash.

An empty scene in another project sees Unity using about 100mb of memory, but when this scene crashes it's running to about 2gb.

Do Movie Textures all get loaded into memory when they're in a scene? Does adding them to a script array force them into memory? Is it wrong to have an array to reference them? Is there a better way to do this -- I had assumed they just streamed off the disk as and when needed...

--Sam

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by GameVortex · Jan 12, 2015 at 09:16 AM

Yes. All objects referenced in a scene/prefab through an array or other variable will be loaded into memory when the scene/prefab is loaded. The solution is to use Resources and load each MovieTexture when needed. So instead of an array with the movieTextures, you create an string array with the name of the movies and use that name to load them.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by mr-sambarlow · Jan 12, 2015 at 11:06 AM

Excellent, cheers GameVortex!

Before I saw your message I solved this a slightly different way -- I ended up converting the movies to .ogv myself and sticking them in StreamingAssets and then using WWW.movie to grab them from a string array for the filenames. I'm assuming this is essentially the same solution.

For the sake of anyone who might have done similar, I'll note that I had issues with the .ogvs running on my Mac -- they would always skip the first few seconds and show black screen whilst playing the audio. I've seen several instances of this reported elsewhere in other questions. My diagnosis was that the conversion via Mira Converter was causing problems. I switched to FFMPEG2THEORA and ran a batch conversion with that -- problem eliminated.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GameVortex · Jan 12, 2015 at 11:17 AM 0
Share

Yes this will work just as well. An important difference though is that the Strea$$anonymous$$gAssets folder is not compressed and built into the assets of a Unity build, but rather included in the Build as a folder and sourcefiles. So any files in the Strea$$anonymous$$gAssets folder will be available to the end user to use directly, in the case of a movie file they can view the movie in a movie player directly.

The Resources functionality will pack it all down into a resources file that cannot easily be unpacked by anything other than your game.

avatar image mr-sambarlow · Jan 12, 2015 at 11:23 AM 0
Share

That's useful to know! Thanks.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

how to make a shooting target ? 2 Answers

Adjust Cone in a Shuriken Particle System 1 Answer

how to only destroy certain blocks? 1 Answer

Will downgrading to a previous version of unity affect my project? 1 Answer

while Loop isn't running, or not doing what I expect it to. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges