hello every one;
i have a box in my stage. i want to put a button that when push it appear open file window that i select a picture then change texture that box .how can i do in your opinion.Good luck.
Unfortunately Unity doesn’t offer support for native open / save-dialogs.
See this thread for a custom solution.
Keep in mind that file access is not available in a webbuild.
thanx Bunny83 for reply but I do not agree with you.
i found something about this maybe useful for you too
Open File Panel.
class EditorUtilityOpenFilePanel {
@MenuItem("Examples/Overwrite Texture")
static function Apply () {
var texture : Texture2D = Selection.activeObject;
if (texture == null) {
EditorUtility.DisplayDialog(
"Select Texture",
"You Must Select a Texture first!",
"Ok");
return;
}
var path = EditorUtility.OpenFilePanel(
"Overwrite with png",
"",
"png");
if (path.Length != 0) {
var www = WWW("file:///" + path);
www.LoadImageIntoTexture(texture);
}
}
}
Bunny83 is correct. And here’s a more direct link to what can get you started.