// Start is called before the first frame update public void Initialize(ITransformHandler locationer, TiledRenderCfg cfg, Material mat, bool isNew, bool is_static, bool isPlayer, int newTexW) { base.Initialize(locationer, cfg, mat, is_static, isPlayer); texRptHeight = 1; if (texRptWidth != newTexW || isNew) { texRptWidth = newTexW; PrepareNewMesh(); centers = new Vector2[newTexW + 1]; } }
//TileRenders are always Initialize-initialized. protected void Initialize(ITransformHandler locationer, TiledRenderCfg cfg, Material material, bool is_static, bool isPlayer) { locater = locationer; parented = locater.HasParent(); isStatic = is_static; material.enableInstancing = false; //Instancing doesn't work with this, and it has overhead, so disable it. render.sharedMaterial = material; render.sortingOrder = renderCounter++; render.sortingLayerID = SortingLayer.NameToID(isPlayer ? cfg.playerSortingLayer : cfg.sortingLayer); DontUpdateTimeAfter = cfg.dontUpdateTimeAfter; //mr.GetPropertyBlock(pb); }