Skip to content

Instantly share code, notes, and snippets.

@anchan828
Created July 3, 2012 17:31
Show Gist options
  • Save anchan828/3041253 to your computer and use it in GitHub Desktop.
Save anchan828/3041253 to your computer and use it in GitHub Desktop.
FileReader使ってローカルのWebPlayer用unity3dファイル読み込む的な
$("#gameData :file").change(function (e) {
var file = e.target.files[0];
var reader = new FileReader();
reader.onload = function (load) {
var uni = load.target.result;
uni = uni.replace("data:base64", "data:application/vnd.unity;base64")
unityObject.embedUnity("unityPlayer",uni, 600,450);
// どっちでもおk
// $("#unityPlayer").html('<iframe src="' + uni + '"></iframe>');
}
reader.readAsDataURL(file);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment