In case that anyone is stumbling across this error:
UnityException: Could not find the requested Platform Texture Settings. This is incorrect, did initialization fail?
It was marked as fixed already, but it isn’t in 2023.2.0a20 and 2023.2.0a22.
I’ve reported it again with detailed reproduction steps as IN-47549.
For me this started happening after installing the dedicated server build target as module. It is happening when “buildTarget: Server” is missing under “platformSettings:” in the metadata file of the texture. For some reason Unity currently isn’t generating the metadata file correctly, resulting in the error above.
A manual workaround for now is to add the missing buildTarget manually to the metadata file. Simply copy the whole block for “buildTarget: DefaultTexturePlatform” and rename the copy to “buildTarget: Server”.
I’m not sure if this is also happening with other build targets on other operating systems or whatever. If you are stuck with this error on another platform, this post should give you an idea what to look for at least.
Here is a screenshot of a modified working metadata file and a bugged default one generated by Unity:
Export out the exr file using unitypackage in 2021.3.30f1 (this version works)
(Note you cant drag the file between the unity versions as it dont work)
Import into version that dont work (in my case 2023.1.10f1)
Voila! its imported (still shows the error if you click on it but you can successfully drag it onto the HDRI Sky property in the Volume profile.
If you have an hdr file and need it in exr format you could use https://convertio.co/ which will do the conversion for free!
Breaks for me as well. Assets other’s have imported on my project are just fine. Attempting to add new assets with Dedicated Server install however throws errors immediately.
There are different issues that cause this exception, Unity has fixed a few of them but it seems new ones appeared or others haven’t been reproduced yet. If you encounter this error, try to recreate in a new project and report a bug.
I just got this on Unity 6000.0.5 and it was caused by a default preset for textures. The preset originally came from Unity 2022.2 and used “iPhone” as a platform name. It seems Unity has renamed this platform to “iOS” in the meantime but the preset caused new textures to have an “iPhone” instead of an “iOS” platform settings entry, which ultimately caused this issue.
It’s easy to check if you’re affected with the same issue: Inspecting the broken preset causes the same exception to be logged in the console repeatedly. Either edit the preset file and replace “iPhone” with “iOS” or recreate the preset. Note that it only happens if the preset is setup as the default, not when applying it manually. To fix the textures, you can either apply the fixed preset or replace “iPhone” with “iOS” in the textures’ meta files.
Thank you Adrian! your post helped me to find a solution for this, it was driving me crazy!
Another guy posted a script to rewrite the metadata so I made a script making a simple modification to change the “iPhone” to “iOS”.
To use it you have to place it in a “Editor” folder and import the “Editor Coroutines” package from the package manager, then you right clic on the folder with the images and “Reimport”.
using UnityEngine;
using UnityEditor;
using Unity.EditorCoroutines.Editor;
using System.Collections;
using System.IO;
using System.Text;
public class FixTexturePlatformSettings: AssetPostprocessor
{
void OnPostprocessTexture(Texture2D texture)
{
EditorCoroutineUtility.StartCoroutine(Fix($"{assetPath}.meta"), this);
}
private IEnumerator Fix(string metafile)
{
// Wait for .meta to be created
while (!File.ReadAllText(metafile).Contains("platformSettings:"))
yield return null;
// Read .meta file
string original = File.ReadAllText(metafile);
StringBuilder meta = new(original);
if (meta.ToString().Contains("iPhone"))
{
meta.Replace("iPhone", "iOS");
Debug.Log("Replaced iPhone to iOS");
}
// Save .meta file
if (meta.ToString() != original)
{
File.WriteAllText(metafile, meta.ToString());
AssetDatabase.Refresh();
}
}
}
Oh, I just found out the reason why. My project was just switched from 2022.2.50f1 and I was using TextureImporter Presets. I deleted that preset and recreated it on Unity 6000.0.23f1 and the error is gone!
This issue got finally resolved at least in my case after comments about presets. I had some presets, most likely imported by some asset, that I didn’t know would affect this. Import works after deleting the presets. Thanks!