In simple words what I am trying to do is, Add GameObject/s in an array through OntriggerEnter and if the GameObjects goes out of the cart then it should be removed from that array on OntriggerExit.
Note : Array should also increase the size by 1 whenever the gameobject enters it and decrease the size by 1 whenever the gameobject gets removed.
I am really new to programming so be sure to explain your answers
Arrays are immutable in size. You can change their content but you cannot resize them without making an entirely brand-new array. This means they are not well-suited to the application you describe above.
Use a List<T> instead, which has .Add() and .Remove() methods:
There are other collection types too, such as HashSet<T>, with more balanced performance adding and removing.
Thx a lot man, I managed to do it with the List<>. Your examples were really long so i just googled it… Anyway Thx again mate 
1 Like