I'm not sure I understand what you're recommending in your first paragraph - moving away from 2D Toolkit and using just simple quads as I had tested with? Seems like I'd lose important functionality that 2D Toolkit would provide.
I can describe it for you but a webplayer will have to wait a bit. Essentially there is a grid of 16x16 tiles (TK2DSprites) with a simple texture on them. They fill up the screen, forming a grid of size 60x40 (2400 tiles) on a Retina iPhone screen.
The important piece here is that the camera is moving at a fixed pace (i.e. sidescroller) to the right. Accordingly, the tiles are "treadmilling" to keep up. In other words, as the camera moves 16 pixels, the last column of tiles to go off the left side of the screen is simply moved to the right. This creates the illusion of an endless grid of tiles. There isn't much more happening there than that.
void spawnInitialTHINGY() {
for (int i = 0; i < (initGridWidth + numTHINGYColsTreadmillAtOnce+1); i++) { // 2 screen-lengths of THINGY tiles
List<tk2dSprite> THINGYCol = new List<tk2dSprite>();
for (int j = 0; j < gridHeight; j++) {
tk2dSprite temp = Instantiate(THINGYTile, new Vector3(THINGYSize*i, THINGYSize*j, 15.0f), Quaternion.identity) as tk2dSprite;
THINGYCol.Add(temp);
}
THINGYTileCols.AddLast(THINGYCol);
}
}
// Update is called once per frame
void Update () {
float dt = Time.deltaTime;
float cameraMoveX = scrollSpeed*dt;
cameraMoveX = Mathf.Round(cameraMoveX * 100f) / 100f;
treadmillTHINGY(cameraMoveX);
treadmillBacking(cameraMoveX);
camera.transform.Translate(new Vector3(cameraMoveX, 0, 0));
}
private void treadmillTHINGY(float cameraMoveX){
THINGYTileMoveCounter += cameraMoveX;
// if camera traveled one THINGY col's width, treadmill leftmost col
if(THINGYTileCols.Count != 0){
if(THINGYTileMoveCounter >= xDistanceToTreadmill){
float leftOverTHINGYX = THINGYTileMoveCounter - xDistanceToTreadmill; // how far past the desired distance did the camera go?
xDistanceToTreadmill = THINGYSize*numTHINGYColsTreadmillAtOnce - leftOverTHINGYX; // set next desired distance before treadmilling again
List<tk2dSprite> firstCol = THINGYTileCols.First.Value; // leftmost THINGY col
List<tk2dSprite> lastCol = THINGYTileCols.Last.Value; // rightmost
float firstColX = firstCol[0].transform.position.x;
float lastColX = lastCol[0].transform.position.x;
// treadmill THINGY tile col(s)
for(int i = 0; i < numTHINGYColsTreadmillAtOnce; i++){
foreach(tk2dSprite currTile in firstCol){ // treadmill all tiles in col
currTile.transform.Translate(lastColX-firstColX + THINGYSize, 0.0f, 0.0f);
currTile.renderer.enabled = true;
currTile.collider.isTrigger = false;
}
THINGYTileCols.AddLast(firstCol); // move col to back of linked list
THINGYTileCols.RemoveFirst();
firstCol = THINGYTileCols.First.Value;
firstColX = firstCol[0].transform.position.x;
lastCol = THINGYTileCols.Last.Value;
lastColX = lastCol[0].transform.position.x;
}
THINGYTileMoveCounter = 0.0f;
}
}
}
Each one has a collider on it used for cutting, but that entire process can be ignored for now probably because drawing itself is taking up so much processing power. If you want to know, I basically raycast at every touch and see where I'm colliding - I then use Physics.OverlapSphere to grab the tiles around that tile and then I turn their renderers and colliders off. When a column is "treadmilled" to the right, I turn everything back on. But, as I said before, even with colliders off the thing lags like nuts.
How can I optimize dynamic batching and drawing itself? I'm not entirely sure what culling is (I think it's the removal of objects that are not in view from being rendered/processed?) but are there ways to optimize that as well? I wonder if moving the camera as opposed to moving the tiles under a fixed camera is causing the issue?
P.S. I've sent a webplayer to your support address.