1
This commit is contained in:
@@ -18,8 +18,17 @@ namespace BITKit.OpenWorld
|
||||
[SerializeField] private ChunkBehaviour chunkBehaviour;
|
||||
private void Start()
|
||||
{
|
||||
chunkBehaviour.OnLodChangedEvent += OnLodChanged;
|
||||
if(colliders is {Length:0})colliders = GetComponentsInChildren<Collider>();
|
||||
try
|
||||
{
|
||||
chunkBehaviour.OnLodChangedEvent += OnLodChanged;
|
||||
if(colliders is {Length:0})colliders = GetComponentsInChildren<Collider>();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BIT4Log.Warning<ColliderChunkObject>(gameObject.name);
|
||||
BIT4Log.LogException(e);
|
||||
}
|
||||
|
||||
}
|
||||
private void OnLodChanged(int arg1, int arg2)
|
||||
{
|
||||
@@ -30,22 +39,28 @@ namespace BITKit.OpenWorld
|
||||
{
|
||||
x.enabled = enabledCollider;
|
||||
}
|
||||
catch (UnassignedReferenceException)
|
||||
{
|
||||
GetCollidersInChildren();
|
||||
OnLodChanged(arg1, arg2);
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BIT4Log.Warning<ColliderChunkObject>(gameObject.name);
|
||||
BIT4Log.LogException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
[BIT]
|
||||
private void GetCollidersInChildren()
|
||||
{
|
||||
colliders = GetComponentsInChildren<Collider>();
|
||||
#if UNITY_EDITOR
|
||||
EditorUtility.SetDirty(this);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user