Search Unity

Problems with build and run (program works fine within Unity)

Discussion in 'AR/VR (XR) Discussion' started by flannegeddes, Apr 20, 2016.

  1. flannegeddes

    flannegeddes

    Joined:
    Mar 10, 2016
    Posts:
    9
    Hi all,

    I recently upgrdaded to the DK2 from the DK1 so I would be able to finish my thesis project.

    When I run my "game" within unity it seems to run fine. However when I build and run the game while it appears to work (it launches, the menu buttons and start buttons work..) it doesn't seem to launch any of the game code. This does not seem to be VR specific as when I disable VR and build the "game" I have the same issue.

    Because it works fine within Unity I'm thinking I am just missing some aspect of the build process. I only have one scene in the "game" and it is selected, so I'm not really sure what else could be the problem. Any help would be greatly appreciated.
     
  2. Thomvdm

    Thomvdm

    Joined:
    Feb 24, 2016
    Posts:
    35
    Did you check the output.log file?
     
  3. flannegeddes

    flannegeddes

    Joined:
    Mar 10, 2016
    Posts:
    9
    Hi, when I check the output log I get this:

    Then that last bit:

    "UnityException: Tag: green is not defined.
    at (wrapper managed-to-native) UnityEngine.GameObject:FindGameObjectsWithTag (string)
    at MainCode.Update () [0x00000] in <filename unknown>:0

    (Filename: Line: -1)"

    repeats until I closed the program.


    Again the part about all of this that is really confusing to me is that the program works fine when I am running it inside of unity, it is only in the build process that I am having this error. I am gravely behind schedule at this point, and would really appreciate any help or suggestions!
     
  4. Thomvdm

    Thomvdm

    Joined:
    Feb 24, 2016
    Posts:
    35
    Are you running it on desktop or mobile device?

    What seems to happen that -somewhere- during the building or running the built, the tag 'green' is not or no longer defined. This causes your game to fail. You're calling a piece of code with <FindGameObjectsWithTag("green"). Start checking there where the fault is. Check your gameobjects if the tag green still exists (dont just look at the current tag, open the Tag menu and see if the tag green is also there).

    Remove the part where you use the green tag, see if that works.. If so, you're at least certain thats where the mistake comes from. Try to get that fixed, I cant help you more without seeing your code.
     
  5. flannegeddes

    flannegeddes

    Joined:
    Mar 10, 2016
    Posts:
    9
    I'm running it on a desktop. Thank you, I will try checking to see if for some reason it no longer exists. I think its possible my programmer started working on this using Unity 4.x and then upgraded to 5.x and that's when the problem started. Unfortunately I have to use 5.x for the VR aspect of the project.
     
  6. flannegeddes

    flannegeddes

    Joined:
    Mar 10, 2016
    Posts:
    9
    Somehow the tags had been deleted entirely. Odd that it still worked within unity.
    Thanks so much Thomvdm, I'm very new to unity and haven't had a chance to use it yet. I added two new tags and retagged the two objects, and voila.
     
  7. Donkii

    Donkii

    Joined:
    Mar 28, 2017
    Posts:
    1
    It happened to me and I managed to fix it, if you have deleted any tag last session it's going to mix things up, the only reason it works on the editor is because it caches the tags. Try deleting the tag that is not working restarting the editor and ad the tags again. Worked for me that way. :D