- Home /
Unity changing itself between builds
Hi everyone,
We are facing some weird problems after building with unity.
1: When pressing play after building, objects are placed at different places than before associated with some error messages:
Coroutine couldn't be started because the the game object 'MapManager' is inactive! UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption. UnityEngine.Transform:SetParent(Transform, Boolean)
Restarting unity solves the problem temporarily, when going through the same process again, the problems return.
2: The builds differ between builds, for example, when building the first time, a menu item is not working, when building after that, that menu item is working like intended, we do not change anything in the meantime.
How can Unity change between builds when we do not change anything by code? We do not touch any piece of code or function. We have some editor scripts but nothing is triggered after building, only after clicking a menu item.
Has someone experienced this kind of problems before?
PS: There's another problem, when upgrading to a new unity version, from 2017.2 to 2017.3, suddenly an old version of the project is opened from months ago, we have not linked unity directly with git, we are using git as separate program. When restarting unity after that, it is the recent version again. We've downgraded to unity 2017.2 again because WWWAudioExtensions were removed from the new unity version.
Any help is appreciated!
Answer by shakecaine · Dec 06, 2017 at 07:02 PM
1.You are using "MapManager" that is inactive in the scene. Look at your objects in the scene and find StartCoroutine function that uses it in code. Your objects are not placed in different places by Unity itself. You must move them by the use of your code.
2. Build you mean Unity build or just editor play? There could be a lot wrong in the code, like your code depends on the values you save outside of Unity. I cannot tell you the definite answer until you provide more detailed look into what you are doing with the menu and on what it can depend on. Code samples too. Rule also should be you do not change Unity version during production unless you are sure that new version does not change what you have in your project.
If Unity opened older version it may mean you had that somewhere on your computer and it detected it. Nothing connected with git.
Thanks for your reply, With building I mean making an actual Android build by using Build & Run. When using the play button, nothing changes in the scene structure. Only after building and then pressing the play button, the problems start to appear.
The $$anonymous$$ap$$anonymous$$anager is by default active in the scene, even during the error message, the $$anonymous$$ap$$anonymous$$anager is still active. The error happens in the 3rd frame after pressing play. At all times, the $$anonymous$$ap$$anonymous$$anager is active. After restarting Unity, the errors disappear and the scene structure is good again. I also did an experiment running a debug log every 0.001 seconds using fixed update and that shows the activity of the mapmanager and it is always active.
The objects are placed by code, it loads data, instantiates the objects and set the parent so they all reside in the icon parent inside the $$anonymous$$ap$$anonymous$$anager. It seems like the parenting part does not work. The parent is set in this way: $$anonymous$$iIcon.transform.SetParent(iconParent, false);
and the iconParent is a serialized private transform which is linked through the inspector. The parent itself is a child object from the map manager.
We want to implement AR into the project which is why we tried 2017.3 but we are reverting for now and updating to a new unity version after we stabalized everything.
We have a partial solution for the menu working half of the time, when building, one moment unity decides to have a certain order of components in the scene and another time when building, it decides to use a different order of components in the scene. To clarify it, there's one object that has multiple child objects who have the same script attached to them. We are using FindObjectOfType which gets the right one half of the time and the wrong one the other half of the time, which half it chooses is decided by how unity builds the project. So this solves some of our problems but does not solve the main problem in this question, why is unity changing between builds?