Hello, im trying to change the color of a background image periodically in the main menu, but unity is not recognizing the “image” keyword. not in start or in update.
all the results of searching are using the “image” keyword.
did this change in unity 2018?
what keyword should i use to access images color and stuff?
mainMenuBackground.GetComponentsInChildren<Image>().color = new Color32(255, 255, 225, 100);
Image is correct, just make sure you have the proper using statement
using UnityEngine.UI;
Note in Visual Studios you can right click the word Image and select the lightbulb to resolve and it should give you the using statement suggestion.
And see @palex-nx post as well as I didn’t notice you were trying to get several Image components and that is important to note also.
1 Like
GetComponentsInChildren returns an array of all images on the object and it’s children in hierarchy. You need to use loop here or, probably switch to GetComponentInChildren
1 Like
Ohhh, thanks, i forgot to add the “UsingEngine.UI”
and yeah i realized late that i had put and S i didnt had to. Thanks for the help guys!