Unity3D2Babylon.SceneBuilder.DumpTexture C# (CSharp) Method

DumpTexture() private method

private DumpTexture ( Texture texture, Material material = null, string name = "", bool isLightmap = false ) : BabylonExport.Entities.BabylonTexture
texture UnityEngine.Texture
material UnityEngine.Material
name string
isLightmap bool
return BabylonExport.Entities.BabylonTexture
        private BabylonTexture DumpTexture(Texture texture, Material material = null, string name = "", bool isLightmap = false)
        {
            if (texture == null)
            {
                return null;
            }

            var texturePath = AssetDatabase.GetAssetPath(texture);
            var textureName = Path.GetFileName(texturePath);
            var babylonTexture = new BabylonTexture { name = textureName };

            if (material != null)
            {
                var textureScale = material.GetTextureScale(name);
                babylonTexture.uScale = textureScale.x;
                babylonTexture.vScale = textureScale.y;

                var textureOffset = material.GetTextureOffset(name);
                babylonTexture.uOffset = textureOffset.x;
                babylonTexture.vOffset = textureOffset.y;
            }

            var texture2D = texture as Texture2D;
            if (texture2D)
            {
                CopyTexture(texturePath, texture2D, babylonTexture, isLightmap);
            }
            else
            {
                var cubemap = texture as Cubemap;
                if (cubemap != null)
                {
                    CopyTextureCube(texturePath, cubemap, babylonTexture);
                }
            }
            return babylonTexture;
        }