Почему один и тот же спрайт во втором случае загрузился в кнопку, а в первом случае не загрузился?
public class Letters : MonoBehaviour
{
public Button[] buttons = new Button[6];
public string[] letters = new string[6] { "я", "я", "у", "ю", "е", "и" };
void Start()
{
for (int i = 0; i < buttons.Length; i++)
{
Button button = buttons[i];
string letter = letters[i];
string spritePath = "LetterGame/" + letter;
Debug.Log("Loading sprite: " + spritePath);
Sprite sprite = Resources.Load(spritePath);
if (sprite != null)
{
button.image.sprite = sprite;
Debug.Log("Sprite loaded successfully for button " + (i + 1));
}
else
{
Debug.LogError("Failed to load sprite for button " + (i + 1));
}
}
}
Failed to load sprite for button 1
UnityEngine.Debug:LogError (object)
Letters:Start () (at Assets/Resources/Scripts/Letters.cs:58)