private static GameObject Combine(IList <EasyDecal> decals, DecalTextureAtlas atlas) { if (decals.Count > 0) { DynamicMesh mesh = new DynamicMesh(DecalBase.DecalRoot, RecreationMode.Always); GameObject root = new GameObject(string.Format("Combined Decals Root [{0}]", atlas.name)); MeshFilter filter = root.AddComponent <MeshFilter>(); MeshRenderer renderer = root.AddComponent <MeshRenderer>(); foreach (EasyDecal decal in decals) { if (decal.Source == SourceMode.Atlas && decal.Projector != null) { mesh.Add(decal.Projector.Mesh, decal.LocalToWorldMatrix, root.transform.worldToLocalMatrix); decal.gameObject.SetActive(false); } } renderer.material = atlas.Material; filter.sharedMesh = mesh.ConvertToMesh(null); //root.transform.parent = DecalBase.DecalRoot.transform; } return(null); }