Commit 15ef967a authored by BRUNEAU Julien's avatar BRUNEAU Julien
Browse files

+ Fix: not spawned agents still visible with LOD

parent 76e4ddb8
......@@ -25,24 +25,26 @@ using UnityEngine;
public class ObjectInterface
{
protected GameObject _MyObj;
protected SkinnedMeshRenderer _MeshRenderer = null;
protected SkinnedMeshRenderer[] _MeshRenderer = null;
public void Init(GameObject obj)
{
_MyObj = obj;
_MeshRenderer = _MyObj.GetComponentInChildren<SkinnedMeshRenderer>();
_MeshRenderer = _MyObj.GetComponentsInChildren<SkinnedMeshRenderer>();
}
public virtual void Show()
{
if(_MeshRenderer)
if(_MeshRenderer.Length>1)
{
_MeshRenderer.enabled = true;
foreach(SkinnedMeshRenderer mesh in _MeshRenderer)
mesh.enabled = true;
}
}
public virtual void Hide()
{
if(_MeshRenderer)
{
_MeshRenderer.enabled = false;
if (_MeshRenderer.Length > 1)
{
foreach (SkinnedMeshRenderer mesh in _MeshRenderer)
mesh.enabled = false;
}
}
public virtual void OnLODChange(int current_lod_id)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment