I’m trying to calculate the amount of pages my inventory has:
float pages = Mathf.CeilToInt(InventoryItemHolder.transform.childCount / itemsPerPage);
the childCount is 19, the itemsPerpage is 16. I logged these numbers in the console to make sure the mistake isn’t in there.
So, pages should be 2 (19 / 16 = 1.1875, rounded to upper int), however is 1.
The same problem happens when I simplify:
float pages = InventoryItemHolder.transform.childCount / itemsPerPage;
Pages is still 1, instead of the expected 1.1875.
Why is this, and how can I solve it?