void HandleDroppedObjects(Object[] objectReferences) { bool addedSomething = false; foreach (Object item in objectReferences) { if (typeof(Texture2D) == item.GetType()) { Texture2D texture = (Texture2D)item; addedSomething = true; if (isTextureCanvasContainsTexture(texture)) { Debug.Log("one of texture is already on Canvas"); } else { string assetPath = AssetDatabase.GetAssetPath(texture); uftAtlas.addNewEntry(texture, assetPath); } } } if (!addedSomething) { Debug.Log("there was no any Texture2D in dropped content"); } }
void HandleDroppedObjects(Object[] objectReferences) { bool addedSomething = false; foreach (Object item in objectReferences) { if (typeof(Texture2D) == item.GetType()) { Texture2D texture = (Texture2D)item; addedSomething = true; if (isTextureCanvasContainsTexture(texture)) { Debug.Log("one of texture is already on Canvas"); } else { string assetPath = AssetDatabase.GetAssetPath(texture); //ensure texture is readable HoneyFramework.TextureUtils.ChangeTextureSettings(texture, true, true, FilterMode.Bilinear, TextureImporterFormat.ARGB32, TextureImporterType.Advanced, true, 2048); if (assetPath == "") { Debug.Log("Asset path missing for " + texture.name); } else { Debug.Log("Proper asset path for: " + assetPath); } uftAtlas.addNewEntry(texture, assetPath); } } } if (!addedSomething) { Debug.Log("there was no any Texture2D in dropped content"); } }