- Home /
Can I access the splash screen texture in code?
I am using my splash screen as a loading screen (with "loading" text overlay). It would be great if I can just resuse the texture from the splash screen rather than load the same texture again. Is there any way to access it in code? If I put an identical texture in the Resources folder, is Unity able to tell it's the same texture as the splash screen and not include it twice in the build?
Thanks.
That is a good question. I don't know of any code that would be able to access it. $$anonymous$$y suggestion would be to first have the texture already in the Resources folder (or where ever else it needs to be) before setting it to be the splash screen. Definitely no need to have two copies of the textures if that was what you were implying.
If your refering to the Unity Splash Screen that appears when you play a Build, i dont think it is included in the Build if you tell it not to, so therefor when you create your own using the same Texture it will not be included twice.
As far as im aware you can only disable the Default Unity Splash screen with Pro.
Answer by casimps1 · Feb 22, 2014 at 05:14 AM
The Unity build pipeline is very smart about not including multiple copies of resources unnecessarily. In fact, I've never seen it do this even when I've tried to make it happen. I'd say you're safe knowing that this won't be an issue.
Unity only includes those assets that are referenced from a scene, so you might have 1GB of assets in your project folder, but if only 200$$anonymous$$B are actually used in scenes, then only those 200$$anonymous$$B are included in the build.
This is not the case if assets are inside any Resources folder(s). All assets inside any Resources-folder will be included in the build, regardless of being used or not. Thus in a similar situation to above, except all assets are in a Resources folder would cause a 1GB build, $$anonymous$$us whatever compression Unity does.
Even if it's included once, I want to be able to access the splash screen texture directly ins$$anonymous$$d of taking the time to load it again after it has disappeared. There are multiple versions of the texture for different devices. The splash screen is always the correct texture for the device. If I cannot access it directly I must load it as an asset bundle. I do not want to keep all sizes of the texture in the Resources folder.
Your answer
Follow this Question
Related Questions
How to load multiple wav files 5 Answers
Resources.load 1 Answer
How to determine which resources are loaded while loading scene 1 Answer
Loading font runtime from file 0 Answers