So I wrote a simple for loop in the update to check if my inventory system is full but it’s not working, what am I doing wrong?
for (int i = 0; i < Slots.Length; i++)
{
if(Slots*.childCount == 1)*
{
isfull = true;
}
else if(Slots*.childCount == 0)*
{
isfull = false;
}
}
isfull changes to true if all of my slots have a child as it should but if I then destroy a child, it won’t make isfull false because the first if statement in this loop is somehow still changing isfull to true, even if that statement is not even applying anymore. If I just add break;
in each if statement, the isfull bool will go crazy and be true from start no matter what the condition is.
Help please