I have recently updated my forked project from .NET 3.5 to .NET 4.6, and for some reason (even though Unity3D advises that there isn't any problem) my project doesn't load things correctly:
By default nothing should change about how Unity behaves or what .NET functionality is available.
Nothing should change, but now ground doesn't load in some parts of the same.
I have inspecting code, and well, I found that some functions aren't behaving as expected. (I didn't debugged them succesfully because if use Debug class, Unity stucks, and if use breakpoints I never find something relevant).
I have realized that some objects are disabled once they are loaded.
For example roads aren't loaded.
We select a object to know where it's located.
And here it is.
As we can see it's disabled. (I couldn't find any object under the player)
Trying to understand what's happening
This fact notices me that something is setting Gameobject field enabled
to false
or SetActive(false)
.
So, I searched in all the project and I found this:
The most probable case is the one from StaticGeometry:
In this case, the object is disabled once it's loaded (as I can see).
In this case if the object isn't visible it doesn't display.
And as you can see in line 31, if _isVisible is the same value as value
then we exit, so, keeping in mind that _isVisible is false
from the beginning we can say, that somewhere the IsVisible variable is being setted as false
, and that happens on line 186 (Hide()
method), that is called on:
This method is called in:
... if ShouldBeVisible()
returns false.
In line 72, line 83, line 86, line 94.
... or in the same IsVisible
property.
if the value that is being setted is true and LodChild is not null then we have to hide LodChild, why? I can't continue here, because I don't understand this logic.
My assumptions on what's going on
Returning back to the road photo:
If we look in it's localPosition it looks weird.
But this is more weird:
Splits (that are baically chunks) are loaded so far away. (That's more weird, there is an unit problem as I can see).
But weirdest things are happening, for example, roads under other positions load correctly.
Other issue for example is that cars doesn't spawn, I think that is because there isn't any ground, when there is ground they spawn, but they pass through it, so the ground doesn't load or if it loads it's not solid where the player stands (maybe because of ShouldBeVisible()
issue?)
If we spawn a vehicle using V
key, they spawn, but it's wheels are very big.
If we watch its scale is about 10, if we set it to 1 then we recover the normal shape.
(I don't have photo of scale = 1, but I have already test it)
So, I said my assumptions is that something is returning bad numbers, they are multiplied.
I have looked into float.Parse, and yes, I found something, but I can't debug it due to big amount of data.
And there is the value... So, a possible problem is that because of my Culture, .NET is parsing this value as millions instead of thousands. And in .NET 3.5 this feature isn't available. I will search how to fix it.
Another fact is sustains my assumption is this:
As you can see position number on the X axis is very big.
So, I will ty to search it on the GTA SA files.
I have checked for empty catch
statments, but I found nothing.
The project is being builded correctly. And If you return the version back to 3.5, everything works again well.
So, what can be happening here? I need to know if I have to keep in mind some fact after upgrading, also, I have searched in:
https://unity3d.com/es/search?refinement=issues&gq=.net%204.x
But didn't find anything.