public void setNewPicture(Texture2D texture, Texture2D persistentBorder = null) { int totalPixelSize = config.canvasSize.x * config.canvasSize.y; if (_actualColors == null || _actualColors.Length != (totalPixelSize)) { _actualColors = new Color32[totalPixelSize]; } size = new Vector2(config.canvasSize.x, config.canvasSize.y); extents.x = size.x / 2; extents.y = size.y / 2; ColorUtil.setWhitePixels(_actualColors); Texture2D backTexture = backLayer.setBlank(_actualColors); if (texture != null) { frontLayer.setTexture(texture); } frontLayerNull = (texture == null); if (persistentBorder != null) { Color32[] colors = persistentBorder.GetPixels32(); if (_persistentLayer == null || _persistentLayer.Length != totalPixelSize) { _persistentLayer = new bool[totalPixelSize]; } for (int i = 0; i < _persistentLayer.Length; i++) { _persistentLayer[i] = colors[i].a > 253; } } else { if (_persistentLayer == null || _persistentLayer.Length != totalPixelSize) { _persistentLayer = new bool[totalPixelSize]; } for (int i = 0; i < totalPixelSize; i++) { _persistentLayer[i] = false; } } canvasBuffer.resetUndoRedo(); }