How to get a single pixel color value from a Texture

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By

Question: How do I get a color of one of the pixels of a texture at a certain position?

I’m building an enhanced Tile Editor professional tool on top of Godot to help with my online role-playing game project. I found after building the game servers that I’m lacking in proper tooling for organizing a Godot-friendly and easily exportable TileMap system that can be loaded into the server for pathfinding logic and server awareness of positions.

I’ll be using the colors to fill in the grid on the left, making it more clear which tiles have been added. The preview render will appear on the left side showing the isometric version of this tile.

:bust_in_silhouette: Reply From: Christoffer Schindel

You want the color of a single pixel in a Texture, right?

First, get the Image of that Texture and then you can use get_pixel, to get a Color of the specific pixel at x, y