Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[SOLVED] Editor and Build Differences?

Discussion in 'Editor & General Support' started by radler470, Jan 15, 2015.

  1. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    I am hoping someone can help me with this issue. Everything in my scene is working fine in the Editor within Unity, but once I build it, I lose some functionality. Like, some of my scripts aren't working, but the game will run.

    Research online, and help from other users sounds like it's not an issue with my script, but somewhere in the building process (makes sense). I can't find any kind of a log, and there are no errors in the console.

    Any ideas?
     
  2. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    544
    Try to isolate the problematic scripts into an empty project and test them again in editor and build mode. If you can spot a specific script that causes this issue, share it here so we can comment better.
     
  3. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Anything get written into the Player.log?
     
  4. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    Where does that file live?
     
  5. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    It appears to be this script, it seems to be the only one that isn't carrying over to the build.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class DestroyObj : MonoBehaviour {
    5.  
    6.  
    7.     void OnEnable()
    8.     {
    9.         StartCoroutine(TurnOff());
    10.     }
    11.  
    12.     IEnumerator TurnOff()
    13.     {
    14.         yield return new WaitForSeconds(2);
    15.         gameObject.SetActive(false);
    16.     }
    17. }
    18.    
    Also, my other canvas (correct GameObject) isn't showing up OnMouseDown with this script:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4.     public class xThroughIN : MonoBehaviour {
    5.     public GameObject xThroughHold;
    6.     public GameObject correct;
    7.  
    8.     [SerializeField]
    9.  
    10.     private xThroughINDoer Dd;
    11.      
    12.     void OnMouseDown () {
    13.         if (xThroughHold.active)
    14.         {
    15.             Dd.Switch (true);
    16.             xThroughHold.SetActive (false);
    17.             correct.SetActive (true);
    18.         }
    19.         else
    20.             Dd.Switch (false);  
    21.     }
    22. }
    23.  
    It does seem to be exclusively UI objects, if that matters.
     
  6. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    Is it a possibility there's something cached? It looks like I have some UI elements that are no longer being called in any scripts (at least I thought), that are still showing up on build. Does Unity save any files like that?
     
  7. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    544
    I couldn't see any problem related to edit/build difference in these scripts.

    There is a free asset which shows debug output in build runtime. Install it and try to see if there is any error/exception in build runtime.
    https://www.assetstore.unity3d.com/en/#!/content/12047
     
  8. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    Thanks, I'll give that a try!
     
  9. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    "Requires Unity 4.2.1 or higher" :( I had to revert back to 4.2.0 to fix some weird player issues.
     
  10. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    Figured it out, solution: I'm an idiot. But, I am soooo glad it wasn't an issue with Unity.

    I am very new to Unity, and as an animator, I am used to saving my files in iterations - which I have been doing, so I forgot to add my newer iterations to my build settings, so my Start menu was going to an older version, which is what was being rendered at Build.

    I feel bad for my stupidity, but thank you to those that were willing to help!