首页 > 解决方案 > how to find unity app icon's guid via script?

问题描述

This is part of ProjectSettings.asset.

m_BuildTargetPlatformIcons:
- m_BuildTarget: Android
  m_Icons:
    - m_Textures:
    - {fileID: 2800000, guid: 646fe89decffe4540babe7ee817c79fb, type: 3}

and I wanna change app icon's guid via script.

private static void ChangeAppIcons()
{
    const string ProjectSettingsAssetPath = "ProjectSettings/ProjectSettings.asset";
    SerializedObject projectSettings = new SerializedObject(UnityEditor.AssetDatabase.LoadAllAssetsAtPath(ProjectSettingsAssetPath)[0]);  
    SerializedProperty iter = projectSettings.GetIterator();
    
    while (iter.Next(true))
    {
        if (iter.name == "m_Textures")
        {
            // TODO
        }
            
    }
    
    projectSettings.ApplyModifiedProperties();
}

according to my script, I can access SerializedProperty which named "m_Textures" but don't know how to access its value.
Or maybe totally wrong way. how can I do?

标签: unity3dguidappicon

解决方案


推荐阅读