batching does not work if i have dynamic gui

here is what i have:

	if(GUI.Button(Rect(GUIHierarchyWidth,i+height),hLabel,wLabel),GetStateOfObject(pathToObject[i]),iGUIStyles.Buttons)){
        	iSceneControl.ChangeObjectsState(pathToObject[i],true);
	}

this is inside loop, everything works fine, texture is chosen in the GetStateOfObject function where Transform of object is passed and state is determined based of the state of material of children (if all are solid, then state is solid, if all are hidden then hidden, and if there are some hidden or transparent then it is mixed) but batching is disabled when i use this. if this function is not used and texture is same batching works. i am developing this for android so batching is important, is there any way to handle this properly?

thank you!

Hard to say anything from your description but its important to keep in mind that transparent materials won’t batch for example and that if you access the material to change anything on it, it creates a clone of the material and thus removes it from any batch too

if i use the code above there are no batching, if i replace GetStateOfObject(pathToObject*), which determines what texture to use based on*
various things, with just a simple texture the batching starts to work. i do not know why?