Quantcast
Viewing latest article 22
Browse Latest Browse All 95

Script working in Edit, not working in Build and Run,Script Working in Editor, not working in Build and Run

I have two issues with my script, hoping to get some direction where i'm going wrong. Issue 1) 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. Issue2) 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: ![alt text][1] And here is the way i create my array of images if a reference is required: ![alt text][2] [1]: /storage/temp/114914-capture.jpg [2]: /storage/temp/114915-capture2.jpg 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!

Viewing latest article 22
Browse Latest Browse All 95

Trending Articles