public void RemoveFromPQSCities() { if (subPQS) { PQSCity[] pqsCitys = this.sphere.GetComponentsInChildren <PQSCity>(); foreach (PQSCity city in pqsCitys) { foreach (Renderer r in city.GetComponentsInChildren <Renderer>(true)) { DeferredRenderer.Remove(r.gameObject, material); } } } }
public static void Add(GameObject go, Material material, bool includeTransparent = false, CelestialBody body = null) { DeferredRenderer dr = go.GetComponents <DeferredRenderer>().FirstOrDefault(r => r.Material == material); if (dr == null) { //Debug.Log("r: " + go.name); Renderer r = go.GetComponent <Renderer>(); if (r != null && r.GetType() != typeof(ParticleSystemRenderer)) { dr = go.AddComponent <DeferredRenderer>(); dr.Material = material; dr.IncludeTransparent = includeTransparent; } } }
public static void Add(GameObject go, Material material, bool includeTransparent = false, CelestialBody body = null) { DeferredRenderer dr = go.GetComponents <DeferredRenderer>().FirstOrDefault(r => r.Material == material); if (dr == null) { Renderer r = go.GetComponent <Renderer>(); if (r != null && r.GetType() == typeof(MeshRenderer)) { if (r.name == "beat_up_tracking_dish") // No idea why this object causes a crash. { return; } dr = go.AddComponent <DeferredRenderer>(); dr.Material = material; dr.IncludeTransparent = includeTransparent; } } }
private void RemoveMaterial(Renderer r) { DeferredRenderer.Remove(r.gameObject, material); }
private void AddMaterial(Renderer r) { DeferredRenderer.Add(r.gameObject, material, isOcean, body); }