godotengine / godotengine/godot

SpriteFrames.get_frame_texture() return the whole spritesheet instead of one frame texture

Open
#98,320 2 comments 0 reactions 0 assignees View on GitHub
discussion documentation topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproductible in v4.3.stable.official [77dcf97d8], v4.2.2.stable.official [15073afe3], v4.2.1.stable.official [b09f793f5]

### System information

Windows 10 - Godot v4.2.2.stable.official [15073afe3] | Forward+

### Issue description

I used the "Add frames from sprite sheet" option in a SpriteFrames to add 4 frames, like this :

![Content of the SpriteFrames](https://github.com/user-attachments/assets/cb3eb550-2f03-4cfe-8542-e84bb7d87ce9)

I expect `sp.get_frame_texture("default", 2)` to return only the frame 2 (the green "3") but it returns instead the whole spritesheet.

![Spritesheet](https://github.com/user-attachments/assets/3bff3c19-bac6-4d10-bf9a-548774bbb395)

### Steps to reproduce

- Create a SpriteFrame
- Use a spritesheet to create frames
- Create a debug MeshInstance3D pointed by a camera
- Use a script to set the debug mesh texture to the result of `get_frame_texture()` at game start
- Check that the displayed texture is not a tile texture, but the whole spritesheet texture

### Minimal reproduction project (MRP)

[Proof that SpriteFrames is busted.zip](https://github.com/user-attachments/files/17440689/Proof.that.SpriteFrames.is.busted.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the SpriteFrames.get_frame_texture() entry point and reproduce the issue using the linked minimal reproduction project, checking the result for frame 2 after importing the spritesheet. Done means the method returns the selected individual frame texture rather than the complete spritesheet, while preserving existing SpriteFrames behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.