Updating the Unity Splashscreen

Looks like they didnt expose the splashscreen property, which is a pain… I have a script that allows me to switch between a Paid version and Free version of an App inside Unity.  Makes developing the App a lot simpler… just flip a toggle and presto, new icon, no ads and no ‘remove ad’ button!

I wanted to swap the splashscreen between the paid and free versions with this toggle, but the fine folks at Unity didn’t think of that, so after some searching, I ended up copying the correct screen over a generic splashscreen, but I had to use File.Copy as AssetDatabase.CopyAsset would reset the splashscreen in the build settings, which defeated the purpose!  I call to Refresh() when the copy was done updated the build setting and asset database.

	string srcPath = AssetDatabase.GetAssetPath(splashScreen);
	Debug.Log("srcPath: " + srcPath);
	string dstPath = Path.GetDirectoryName(srcPath);
	dstPath+="/splashScreen" + Path.GetExtension(srcPath);
	Debug.Log("Duplicating " + srcPath + " into " + dstPath);
	File.Copy(srcPath,dstPath,true);
	//AssetDatabase.CopyAsset(srcPath,dstPath); // doesnt work correctly
	AssetDatabase.Refresh();

Hope that helps someone else till they fix it.

Leave a Reply