Reputation: 1
Since today I have a very strange bug in Unity 2018.3.7f1 (my company currently only supports the 2018 version). As soon as I switch on any box collider I only have <10 FPS, if I switch the box collider off again I immediately have >80 FPS again. According to Unity Profiler, the problem is physics. Here is an example with a scene with only a cube… once with the box collider switched on and once with the box collider switched off. Anyone have an idea what the problem could be? The problem also occurs with a new project.
Upvotes: 0
Views: 201
Reputation: 1
@YGreater Yes, it's completely independent of Rigidbody.
@ipodtouch0218 "Physics.Processing / 0.085ms / Total: 83.13ms (997 Instances)" The many instances are very strange. I think I was able to narrow down the problem, I think the origin of the problem could be that I used my own AssetBundle before and something has been causing problems there recently (this AssetBundle actually always worked in the past). It's funny that I only have it in the project hierarchy at the moment, but don't load it in the scene. To be on the safe side, here is the code I basically use for the project:
private void Awake()
{
if (File.Exists(Helper.mlFilePath))
{
MLFile file = JsonUtility.FromJson<MLFile>(File.ReadAllText(Helper.mlFilePath));
var loadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.dataPath + "/AssetBundles/simulation_bundle"));
if (loadedAssetBundle == null)
{
Debug.Log("Failed to load AssetBundle!");
return;
}
foreach (var obj in file.Objects)
{
foreach (var gameObject in loadedAssetBundle.LoadAllAssets<GameObject>())
{
if (gameObject.GetComponent<MetaData>().getVisualId().Equals(obj.Symbol.VisualId))
{
float yOffset = 0;
if (gameObject.name.Contains("WT"))
yOffset = 0.25f;
Instantiate(gameObject, new Vector3(obj.Position.X / 100, yOffset, obj.Position.Y / 100), Quaternion.Euler(0, obj.Rotation, 0));
break;
}
}
}
loadedAssetBundle.Unload(false);
}
this.fixedDeltaTime = Time.fixedDeltaTime;
Time.timeScale = 1f;
}
Upvotes: 0