- Home /
U3DXT access LaunchImage/Splash screen?
I'd like to access the Splash screen texture from a Unity script. In searching for an answer I found this thread: http://stackoverflow.com/questions/19410066/ios-7-xcode-5-access-device-launch-images-programatically
So I want to do something like: Texture2D splash = new UIImage(@"LaunchImage").ToTexture2D(); (but that doesn't work)
Is it possible to access the splash screen texture this way? Thanks.
No, it is not possible to access the splash screen. If you are an iOS Pro user simply create the splash screen you want to display in the editor.
Answer by DuFF14 · Feb 26, 2014 at 05:29 PM
I figured it out.
string splashScreenName = "Default-Portrait@2x.png"; //you'll need to change this per device
string dataPath = Application.dataPath.Substring (0, Application.dataPath.Length - 4); //Remove "Data" from the end of the path
string imagePath = dataPath + splashScreenName;
UIImage image = new UIImage(imagePath);
Texture2D splashTexture = image.ToTexture2D();
Answer by u3dxt · Feb 26, 2014 at 06:41 PM
Hi DuFF14, thanks for sharing this. One thing to be careful about using UIImage.ToTexture2D() is that it creates a new Texture2D, and the caller is responsible for destroying it once done, by calling Texture2D.destroy(splashTexture).
Alternatively, you can use Texture2D.LoadImage() passing in the bytes you get from the file.
Your answer
Follow this Question
Related Questions
iOS Launch Screen Time 1 Answer
ios splash screen problem 2 Answers
Does u3dxt support ios 8 1 Answer