I’m setting up an inventory screen UI for a game. I wanted to write a function that changes to match the player’s current set of items when you open it up. The way the inventory UI works is that there’s a panel with a set of button objects as children.
However I’m having trouble getting to actually select the Image components of those buttons. I can select their transforms using this code:
private var itemSlots = items.GetComponentsInChildren(Transform);
(items is the Items GameObject, set through the inspector)
However when I try to use Image
as the component type I’m getting Unknown Identifier errors. Am I trying to navigate the hierarchy wrong or is there some other problem here?