public void SetupTriggers(TerrainGridSystem tgs) { TerrainTrigger trigger = terrain.gameObject.GetComponent <TerrainTrigger> (); if (trigger == null) { trigger = terrain.gameObject.AddComponent <TerrainTrigger> (); } trigger.Init <TerrainCollider> (tgs); }
public void SetupTriggers(TerrainGridSystem tgs) { for (int k = 0; k < rr.Length; k++) { if (rr[k].renderer == null) { continue; } if (rr[k].renderer.GetComponent <TerrainTrigger>() == null) { TerrainTrigger trigger = rr[k].renderer.gameObject.AddComponent <TerrainTrigger>(); trigger.Init <MeshCollider>(tgs); } } }