We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unity Editor 2022.3.19 UnityEditor.cs
[MenuItem("Assets/Create/DragonBones/Create Unity Data", false, 32)] private static void _CreateUnityDataMenuItem() { foreach (var dragonBonesSkePath in _GetDragonBonesSkePaths(true)) { var dragonBonesSke = AssetDatabase.LoadMainAssetAtPath(dragonBonesSkePath) as TextAsset; var textureAtlasJSONs = new List<string>(); GetTextureAtlasConfigs(textureAtlasJSONs, AssetDatabase.GetAssetPath(dragonBonesSke.GetInstanceID())); UnityDragonBonesData.TextureAtlas[] textureAtlas = new UnityDragonBonesData.TextureAtlas[textureAtlasJSONs.Count]; for (int i = 0; i < textureAtlasJSONs.Count; ++i) { string path = textureAtlasJSONs[i]; //load textureAtlas data UnityDragonBonesData.TextureAtlas ta = new UnityDragonBonesData.TextureAtlas(); // 可能unity5或更早期 支持AssetDatabase完整路径,但2022已经出现问题了 // Invalid AssetDatabase path: D:\XXX\XXX\Assets\Resources/YYY.png. // Use path relative to the project folder. // 2024/10/15 强制切断为相对路径 // ===== string currentDirectoryPath = Directory.GetCurrentDirectory().ToString(); path = path.Substring(currentDirectoryPath.Length + 1); // ==== //load texture ta.textureAtlasJSON = AssetDatabase.LoadAssetAtPath<TextAsset>(path); path = path.Substring(0, path.LastIndexOf(".json")); ta.texture = AssetDatabase.LoadAssetAtPath<Texture2D>(path + ".png"); //load material ta.material = AssetDatabase.LoadAssetAtPath<Material>(path + "_Mat.mat"); ta.uiMaterial = AssetDatabase.LoadAssetAtPath<Material>(path + "_UI_Mat.mat"); textureAtlas[i] = ta; } // CreateUnityDragonBonesData(dragonBonesSke, textureAtlas); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Unity Editor 2022.3.19
UnityEditor.cs
The text was updated successfully, but these errors were encountered: