- Home /
Script working in Editor, not working when 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:
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!
Answer by NathanGG · Apr 13, 2018 at 07:13 PM
@Rigged101 (This is for MonoDevelop) Did you save the script? If you didn't just press ctrl + s or go to the menu in the top left and open it, and press save.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
if player transform position x do something 1 Answer
UI Buttons do not click 0 Answers