无法在 Unity 中获取 UI.Image 的图像或纹理

cant get Image or Texture of UI.Image in Unity

m_Image = GetComponent<Image>();i am trying to put a list of images and whenever clicked i want to replace clicked image to a plain . as i am a beginner in unity please share your thoughts,,

As shown here the pen image should be replaced in the floor

我相信你应该使用

GetComponent<Image>().sprite

并设置精灵而不是图像。

你应该使用 Sprite 而不是图像(sprite 是 unity 图像组件的一部分)

GetComponent<Image>().sprite;

阅读更多关于 Sprites 的内容 Unity Manual