Get texture that is set on a 2D/3D image

to be able to get which texture is set on a 2D/3D image object to be able to compare if the texture is (the texture i pick from assets) then bool is true, this would help a lot