Why do I only get spriteFrame when importing files?

:wave:
When I import the file I only get spriteFrame without texture. It’s here right away spriteFrame and texture.

<img src="https://docs.cocos.com/creator/manual/en/asset/sprite-frame/spriteframe.png">

If I change the file type to texture, the icon in texture still doesn’t appear like it does here.

<img src="https://docs.cocos.com/creator/manual/en/asset/texture/sub-texture.png">

This is what my loaded image looks like with texture type

I went and checked if the texture was loading via

resources.load('texture/asd/texture', Texture2D, (err, i)=>{
       
          console.log(i)
        });

view console, _name = null
I don’t fully understand. But it seems the structure is not loaded or is loaded but not completely. I can’t get the file name and I can’t get the image.data I don’t understand, maybe some settings are not enabled?

2-28-2024 16:09:07 - log: [PreviewInEditor] Texture2D {
  _objFlags: 0,
  _name: '',
  __editorExtras__: {},
  _callbackTable: [Object: null prototype] {},
  loaded: true,
  _native: '',
  _nativeUrl: '',
  _file: null,
  _ref: 0,
  _format: 35,
  _minFilter: 2,
  _magFilter: 2,
  _mipFilter: 1,
  _wrapS: 2,
  _wrapT: 2,
  _wrapR: 2,
  _anisotropy: 1,
  _width: 300,
  _height: 200,
  _id: 'Tex.673',
  _samplerInfo: SamplerInfo {
    minFilter: 2,
    magFilter: 2,
    mipFilter: 1,
    addressU: 2,
    addressV: 2,
    addressW: 2,
    maxAnisotropy: 1,
    cmpFunc: 7
  },
  _gfxSampler: WebGL2Sampler {
    _objectType: 6,
    _objectID: 66226,
    _typedID: 65541,
    _info: SamplerInfo {
      minFilter: 2,
      magFilter: 2,
      mipFilter: 1,
      addressU: 2,
      addressV: 2,
      addressW: 2,
      maxAnisotropy: 1,
      cmpFunc: 7
    },
    _hash: 465562,
    _gpuSampler: {
      glSamplers: Map(0) {},
      minFilter: 2,
      magFilter: 2,
      mipFilter: 1,
      addressU: 2,
      addressV: 2,
      addressW: 2,
      glMinFilter: 9985,
      glMagFilter: 9729,
      glWrapS: 33071,
      glWrapT: 33071,
      glWrapR: 33071,
      getGLSampler: [Function: getGLSampler]
    }
  },
  _gfxDevice: WebGL2Device {
    _gfxAPI: 7,
    _renderer: 'Intel Iris Pro OpenGL Engine',
    _vendor: 'Intel Inc.',
    _features: [
      true,  true,  true,
      true,  false, false,
      false, false, false,
      false
    ],
    _formatFeatures: [
       0,  0,  0,  0, 31, 15, 31, 31, 27, 31, 31, 31,
      31, 31, 31, 15, 31, 31, 27, 31, 31, 31, 31, 31,
      31, 15, 15, 31, 31, 27, 31, 31, 30, 31, 31, 31,
       0, 15, 15, 31, 31, 27, 31, 31, 31, 31, 31, 15,
      15, 15, 15, 15, 15, 15, 15, 15,  6,  6,  6,  6,
       6,  6,  6,  6,  0,  0,  0,  0,  0,  0,  0,  0,
       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
       0,  0,  0,  0,
      ... 17 more items
    ],
    _queue: WebGL2Queue {
      _objectType: 14,
      _objectID: 65536,
      _typedID: 65536,
      _type: 0,
      numDrawCalls: 0,
      numInstances: 0,
      numTris: 0
    },
    _cmdBuff: WebGL2PrimaryCommandBuffer {
      _objectType: 13,
      _objectID: 65537,
      _typedID: 65536,
      _queue: [WebGL2Queue],
      _type: 0,
      _numDrawCalls: 42,
      _numInstances: 0,
      _numTris: 204,
      cmdPackage: [WebGL2CmdPackage],
      _cmdAllocator: [WebGL2CommandAllocator],
      _isInRenderPass: false,
      _curGPUPipelineState: [Object],
      _curGPUDescriptorSets: [Array],
      _curGPUInputAssembler: [Object],
      _curDynamicOffsets: [Array],
      _curDynamicStates: [DynamicStates],
      _isStateInvalied: false
    },
    _numDrawCalls: 42,
    _numInstances: 0,
    _numTris: 204,
    _memoryStatus: MemoryStatus { bufferSize: 7685664, textureSize: 53835296 },
    _caps: DeviceCaps {
      maxVertexAttributes: 16,
      maxVertexUniformVectors: 1024,
      maxFragmentUniformVectors: 1024,
      maxTextureUnits: 16,
      maxImageUnits: 0,
      maxVertexTextureUnits: 16,
      maxColorRenderTargets: 0,
      maxShaderStorageBufferBindings: 0,
      maxShaderStorageBlockSize: 0,
      maxUniformBufferBindings: 75,
      maxUniformBlockSize: 65536,
      maxTextureSize: 16384,
      maxCubeMapTextureSize: 16384,
      maxArrayTextureLayers: 2048,
      max3DTextureSize: 2048,
      uboOffsetAlignment: 256,
      maxComputeSharedMemorySize: 0,
      maxComputeWorkGroupInvocations: 0,
      maxComputeWorkGroupSize: [Size],
      maxComputeWorkGroupCount: [Size],
      supportQuery: false,
      clipSpaceMinZ: -1,
      screenSpaceSignY: 1,
      clipSpaceSignY: 1
    },
    _bindingMappingInfo: BindingMappingInfo {
      maxBlockCounts: [Array],
      maxSamplerTextureCounts: [Array],
      maxSamplerCounts: [Array],
      maxTextureCounts: [Array],
      maxBufferCounts: [Array],
      maxImageCounts: [Array],
      maxSubpassInputCounts: [Array],
      setIndices: [Array]
    },
    _samplers: Map(6) {
      458778 => [WebGL2Sampler],
      458762 => [WebGL2Sampler],
      461450 => [WebGL2Sampler],
      461445 => [WebGL2Sampler],
      461466 => [WebGL2Sampler],
      465562 => [WebGL2Sampler]
    },
    _generalBarrierss: Map(3) {
      848346825 => [GeneralBarrier],
      4175296558 => [GeneralBarrier],
      3257522927 => [GeneralBarrier]
    },
    _textureBarriers: Map(0) {},
    _bufferBarriers: Map(0) {},
    _swapchain: WebGL2Swapchain {
      _objectType: 1,
      _objectID: 65538,
      _typedID: 65536,
      _transform: 0,
      _colorTexture: [WebGL2Texture],
      _depthStencilTexture: [WebGL2Texture],
      stateCache: [WebGL2StateCache],
      nullTex2D: [WebGL2Texture],
      nullTexCube: [WebGL2Texture],
      _canvas: [HTMLCanvasElement],
      _webGL2ContextLostHandler: [Function: bound _onWebGLContextLost],
      _extensions: [Object],
      _blitManager: [IWebGL2BlitManager]
    },
    _context: WebGL2RenderingContext {},
    _bindingMappings: {
      blockOffsets: [Array],
      samplerTextureOffsets: [Array],
      flexibleSet: 3
    },
    _textureExclusive: [
      true,  true,  true,  true,  false, true,  false, false, true,
      false, false, false, false, false, false, true,  false, false,
      true,  false, false, false, false, false, false, true,  true,
      true,  true,  true,  true,  true,  true,  true,  true,  false,
      true,  false, true,  false, false, true,  false, false, false,
      false, false, false, true,  false, false, false, false, true,
      false, false, true,  true,  true,  true,  true,  true,  true,
      true,  true,  true,  true,  true,  true,  true,  true,  true,
      true,  true,  true,  true,  true,  true,  true,  true,  true,
      true,  true,  true,  true,  true,  true,  true,  true,  true,
      true,  true,  true,  true,  true,  true,  true,  true,  true,
      true,
      ... 17 more items
    ]
  },
  _textureHash: 3439531138,
  _gfxTexture: <ref *1> WebGL2Texture {
    _objectType: 3,
    _objectID: 66227,
    _typedID: 65620,
    _info: TextureInfo {
      type: 1,
      usage: 22,
      format: 35,
      width: 300,
      height: 200,
      flags: 1,
      layerCount: 1,
      levelCount: 9,
      samples: 1,
      depth: 1,
      externalRes: 0
    },
    _viewInfo: TextureViewInfo {
      texture: [Circular *1],
      type: 1,
      format: 35,
      baseLevel: 0,
      levelCount: 9,
      baseLayer: 0,
      layerCount: 1
    },
    _isPowerOf2: false,
    _isTextureView: false,
    _size: 319840,
    _gpuTexture: {
      type: 1,
      format: 35,
      usage: 22,
      width: 300,
      height: 200,
      depth: 1,
      size: 319840,
      arrayLayer: 1,
      mipLevel: 9,
      samples: 1,
      flags: 1,
      isPowerOf2: false,
      glTarget: 3553,
      glInternalFmt: 32856,
      glFormat: 6408,
      glType: 5121,
      glUsage: 0,
      glTexture: WebGLTexture {},
      glRenderbuffer: null,
      glWrapS: 0,
      glWrapT: 0,
      glMinFilter: 0,
      glMagFilter: 0,
      isSwapchainTexture: false
    },
    _gpuTextureView: {
      gpuTexture: [Object],
      type: 1,
      format: 35,
      baseLevel: 0,
      levelCount: 9
    }
  },
  _gfxTextureView: WebGL2Texture {
    _objectType: 3,
    _objectID: 66228,
    _typedID: 65621,
    _info: TextureInfo {
      type: 1,
      usage: 22,
      format: 35,
      width: 300,
      height: 200,
      flags: 1,
      layerCount: 1,
      levelCount: 9,
      samples: 1,
      depth: 1,
      externalRes: 0
    },
    _viewInfo: TextureViewInfo {
      texture: [WebGL2Texture],
      type: 1,
      format: 35,
      baseLevel: 0,
      levelCount: 9,
      baseLayer: 0,
      layerCount: 1
    },
    _isPowerOf2: false,
    _isTextureView: true,
    _size: 319840,
    _gpuTexture: {
      type: 1,
      format: 35,
      usage: 22,
      width: 300,
      height: 200,
      depth: 1,
      size: 319840,
      arrayLayer: 1,
      mipLevel: 9,
      samples: 1,
      flags: 1,
      isPowerOf2: false,
      glTarget: 3553,
      glInternalFmt: 32856,
      glFormat: 6408,
      glType: 5121,
      glUsage: 0,
      glTexture: WebGLTexture {},
      glRenderbuffer: null,
      glWrapS: 0,
      glWrapT: 0,
      glMinFilter: 0,
      glMagFilter: 0,
      isSwapchainTexture: false
    },
    _gpuTextureView: {
      gpuTexture: [Object],
      type: 1,
      format: 35,
      baseLevel: 0,
      levelCount: 9
    }
  },
  _mipmapLevel: 9,
  _textureWidth: 300,
  _textureHeight: 200,
  _baseLevel: 0,
  _maxLevel: 1000,
  _mipmaps: [
    ImageAsset {
      _objFlags: 0,
      _name: '',
      __editorExtras__: {},
      _callbackTable: [Object: null prototype] {},
      loaded: true,
      _native: '.jpeg',
      _nativeUrl: 'http://.../remote/resources/native/10/10fb73e2-9603-49dc-abd9-4fa844a737ea.jpeg',
      _file: null,
      _ref: 1,
      _nativeData: HTMLImageElement {},
      _exportedExts: null,
      _format: 35,
      _width: 0,
      _height: 0
    }
  ],
  _generatedMipmaps: [
    ImageAsset {
      _objFlags: 0,
      _name: '',
      __editorExtras__: {},
      _callbackTable: [Object: null prototype] {},
      loaded: true,
      _native: '.jpeg',
      _nativeUrl: 'http://.../remote/resources/native/10/10fb73e2-9603-49dc-abd9-4fa844a737ea.jpeg',
      _file: null,
      _ref: 1,
      _nativeData: HTMLImageElement {},
      _exportedExts: null,
      _format: 35,
      _width: 0,
      _height: 0
    }
  ]
}

what is your purpose? image.data or image._name

My ultimate goal is to get an array of pixel colors and vertices to play with. I explore properties and functions in search of the ultimate goal.
my goal is to get an array of pixel colors and vertices so that I can play with them. I explore properties and functions in search of the ultimate goal. I assumed that it was impossible to get colors and vertices from a spriteFrame, so I started playing with the Texture2D type.

I haven’t had time to study the answer from another topic yet.

For the processing of vertices and pixels, shaders are often required. Vertex shaders are responsible for processing vertex transformations, while fragment shaders handle pixel-level transformations.

1 Like