0 votes

Hi i have small question because i try get pixel color under my mouse and everything was good but when i open my game i got many errors with locking and unlocking image i trying fix it but i failed it. Someone could tell my how can i fix it ?

I using c# :)

under i give image with my errors and code

https://prnt.sc/pvd0ab

https://prnt.sc/pvd0gj

asked Nov 11, 2019 in Projects by daniel500013 (64 points)

1 Answer

+1 vote
Best answer

You don't need to load an image. You get an image via GetViewport()...

var image = GetViewport().GetTexture().GetData();
image.Lock();
GD.Print(image.GetPixel(.....and so on.....));
image.UnLock();
answered Nov 11, 2019 by wombatstampede (3,189 points)
selected Nov 11, 2019 by daniel500013
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.