Hi,
For some reason UIPrefabToolbar preview generation is not working well for us. It behaves quite strange (for example we see transparent background in our button previews, while they are not transparent). Maybe we are doing something wrong. Anyway, we done something fun, and maybe it would be wise to add it to NGUI.
We wanted to be able to use png screenshots created by ourselves instead of auto generated ones.
What I have done is adding field with image path to UISnapshotPoint, and told UIPrefabToolbar to use it if not empty.
This can be useful for both Unity Free and Pro users.
Exact code modifications:
UISnapshotPoint:
public string thumbnailPath = "";
UISnapshotPointEditor:
(line 33) NGUIEditorTools.DrawProperty("Path to thumbnail", serializedObject, "thumbnailPath");
UIPrefabTool:
(top of LoadPreview function:)
static Texture2D LoadPreview (Item item, string path="")
{
if(path == "") path = "Assets/NGUI/Editor/Preview/" + item.prefab.name + ".png";
(after finding snapshot point:)
// Try to find the snapshot point script
if (point == null) point = child.GetComponentInChildren<UISnapshotPoint>();
// Use snapshot from png if provided
if (point != null && point.thumbnailPath != "") {
item.tex = LoadPreview(item, point.thumbnailPath);
item.dynamicTex = true;
return;
}
Please consider adding something like that to next version of NGUI, I'm sure it could be beneficial outside of my team too :-)
Cheers,
Kris