I have two issues with my script, hoping to get some direction where i’m going wrong.
OnTriggerEnter2D() I execute an if statement checking if my collider.name is equal to an item name and if it does do something. This works for both the Build, and the Editor. If i do an if statement checking the same thing but with collider.gameobject.tag because i want to group items under a tag, in that case it works only in editor but not in Build. Im running a PC standalone build and run each time.
I have an inventory right now that is basically just an array of image gameobjects that have a child image gameobject attached to it that i change when i want to put an item into the inventory upon collision. This works fine in the editor, i just have a for loop that looks through the array that finds the first item within my array that is empty and changes the image there. Now when i do it in run and build this is no longer working.
Here i have attached the image containing the OnTriggerEnter2D method for reference:
And here is the way i create my array of images if a reference is required:
Id just like to say, im just interested in why such occurrences are happening between build and editor. The way i create the inventory is most likely subject to change.
Thank you in advance!
Pls send help!