Loading a file into a unity3d application that is embedded using webplayer - unity3d

I have no experience with Unity3D so figured I would ask here.
I have an application built in Unity3D that allows the user to save a file at some point. This file can then be loaded back into the application for use later. Works fine in the iOS version of the app. However I also have the application embedded in a browser using webplayer.
When embedded I am unable to load files into the application due to, what I assume to be, security/browser restrictions.
So, is there a way to fix this, or is there a way to have a normal html form and have this allow the file to be uploaded and opened within the application?
Any help would be greatly appreciated :)

Basically, you have two good ways to solve that issue.
1) The easiest with minimal work is to use PlayerPrefs for storing player progress data. You can use it on standalone build as well, and you don't have to worry about saving any files then. On web player, there are however few limits:
WebPlayer
On Web players, PlayerPrefs are stored in binary files in the following locations:
Mac OS X: ~LibraryPreferencesUnityWebPlayerPrefs
Windows: %APPDATA%\Unity\WebPlayerPrefs
There is one preference file per Web player URL and the file size is limited to 1 megabyte. If this limit is exceeded, SetInt, SetFloat and SetString will not store the value and throw a PlayerPrefsException.
Good to remember is to make sure you encrypt your values, to prevent cheating by users.
2) Second option in WebPlayer is to use server to provide authentication and saving progress. It is quite usual for web apps, especially on commercial platforms like Facebook.
This option is more versatile, because user can play from any desktop and he will always have access to his saves, where with PlayerPrefs it would be very hard to achieve.
On WebPlayer it is very difficult to force user to save anything because of the security limits. Solutions like providing user with save-download link and then reuploading it manually seems as very bad option, and it probably would involve a server anyway.

Related

Unity SCORM Suspend_Data issue

I am working on a serious game project on Unity for a client that must be playable on a browser and compatible with SCORM.
I discovered the concept of SCORM and LMS with this project.
I made an internal backup system, with a JSON file, which works very well when I build for PC, my score saves well and when I restart my project, I can load my backup.
Unfortunately when I build in WebGL and publish to the SCORM Cloud website, the save and load information doesn't pass.
I found on the internet that I should use suspend_data functions, I did find the description of its functions, but I can't find how to send or retrieve my score.
I must have a problem in the conversion of JSON in string.
Can you help me with this, or give me a hint.
I thank you in advance.
Sincerely
There might be a couple different issues at play here.
First off, I'm not sure that SCORM Cloud allows for the Unity Player mime type today. That could be verified with a request to support#scorm.com and it may be able to be added if it isn't currently supported.
Second, how are you communicating with the SCORM API? When a SCORM course is launched in the player, there is a javascript API exposed with some basic calls you need to make. This is where you'd set completion or a score (or suspend_data if needed) and it tells the LMS what data to persist for the learner session and makes values available from previous launches if set to resume.
This won't happen automatically, so you need to handle that in your Unity package with either a wrapper, or some javascript calls to the proper context from within the package.
Hopefully all this is helpful for your understanding of SCORM. Feel free to reach out to support#scorm.com since you're using SCORM Cloud and they can help you if you need more information.
Note: I work for Rustici Software on the SCORM Cloud team and have some light Unity experience.

Accessing assets/resources (e.g., a word list) from iPhone apps

I'm interested in playing around with the word list used in the popular iPhone game "Draw Something".
I don't know how iPhone apps are developed, compiled, or deployed, but I'm wondering if, once the app is installed on my iPhone, the word list is kept in a file I can access/read/modify?
I'm sure this varies from app to app - some apps might keep resources like this on a server, and in other apps, the data might be compiled. But perhaps some apps read data like this from something like XML- or CSV-formatted text files that are stored on the phone, and potentially accessible? (Or, backed up to your PC or Mac?)
If so - are those files accessible? If so, where/how?
I'm not an iOS developer, and I'm not interested in copying, stealing, or plagarizing anything from an existing app.
Specifically - I am interested in creating an information visualization based on the word list from "Draw Something." How many words are there? Which words are "easy", which are "hard"? Is it harder to draw a verb, a noun, or an adjective? I thought this might be a fun, (potentially) interesting thing to analyze.
That got me thinking... "I wonder how apps are stored on my phone?" (Or, backed up to my PC/Mac). Are they a single compiled executable? A handful of dlls? Is app data stored in simple text files, a database, or something else? Are these files accessible? Etc.
Many thanks in advance!
You probably got down voted (and may yet get removed) because this isn't really a programming question, and those are what SO is for. Power-user questions fit better elsewhere in the Stack Exchange network.
In the meantime, if it turns out this word list is stored in an easily readable file in the app's bundle... Apps are stored on the Mac/PC you sync your device to, somewhere under the iTunes Music folder. Each is a ".ipa" file, which is really just a zip archive. Change the file extension and you can unzip it to see what's inside.
Apps get file system access through the sdk. There is also a object-relational framework called Core Data that lets an app create and access a SQLite store. Apps can also maintain a small amount of state (usually user prefs) in a shared user defaults store.
In one word: No.
I'm 99% sure you can't lift the word list from "Draw Something". It's boxed with the app bundle, and not readily readable as a file.

Web-based or App-based for an Events-tracker?

I'm trying to plan out an application on the iPhone/Android that could be used to track dates/locations of events and update them as necessarily but I really have no idea what kind of method I should take.
Currently, there's two ideas for methods in my head:
1) Make a mobile webpage/website that could be updated with the necessarily information, then display this particular webpage/website on the App for users to view.
2) Make an app in iOS/Android to do the above without displaying the webpage at all.
The first idea is the easiest for me to grasp, since I roughly know the procedures of setting this method up. Displaying the webpages on a iPhone/Android screen should be relatively easy and this also allows me to only update the webpage with the latest information and all without (hopefully) building some kind of update system for the app itself.
The second idea is probably the better of the two, since I can make use of all the nifty features in the iOS/Android to make some pretty cool (what are the cool things, i don't know yet) things. I'm not exactly experienced in the field of creating apps, and I really have no idea how to start some kind of self-update functionality on an app, seeing all the apps I've done thus far are offline-based apps that does not communicate with anything save for local files. Should I get the App upon startup to download a file (XML or whichever?) to "read" the contents then update as necessarily?
Or should I just go for the first method, since it can be more efficient than the second one?
I'm really lost here, can anyone offer some tips and advice?
I believe that the first approach is a good one but I would suggest the following:
1- Create the website that will do all the business in your mind then
2- Port out the application in an easy way to be a mobile application how? Please have a look into this http://www.appcelerator.com/
3- Another idea that would save you the pain of going into all the above is to create a facebook application, this way you can make use of the facebook infrastructure and you will have the viral effect as I guess thats what you are looking for.
I hope I've introduced a good tips for you.

Data syncing with DropBox API and iOS

I have an iOS app which stores data in the local directory. I'd like to be able to sync this data between multiple devices running my app. Currently this is using core data, but I'd expect to have to change to some text-based file storage system to make syncing easier.
I was expecting the DropBox API would make this nice and easy, and that I could tell the API to simply sync the contents of my data folder on startup/save. However it seems the DropBox API is nothing more than a glorified way of uploading and downloading files.
Am I wrong on this assumption? Can the DropBox API actually make it easy to keep a folder full of text files in sync? If not, is there some other service or even advice you can give? Syncing is hard - I was hoping DropBox would make it easier.
Using /metadata, getting information about the contents of a folder couldn't be easier. All you need to do is check the modified date, and if it's different than yours locally, perform the appropriate action. It will also give you the metadata for any file contents, so you can pick out which files need to be uploaded / downloaded / added / removed as necessary.
Any more functionality than this would be very application-dependent; you can decide for yourself when and how you want to deal with differing files.
Dropbox API Documentation
Won't repeat since Andy has answered your question, thought you may also find this tutorial helpful:
http://www.nanaimostudio.com/blog/2011/1/20/how-to-synchronize-your-app-data-using-dropbox-api.html
Check out the new DropBox Sync API.
As ohho mentioned, there's the DropBox Sync API available now which I think will do what you mentioned (I haven't tried it personally, as I integrated support for Dropbox in my app using the earlier SDK, before this came along). This will probably suffice if you're just working with dropbox.
In my case I've been starting to add support for additional online storage ("Cloud") services to my app, and am finding that it's somewhat challenging to deal with the differences between them in how they handle various concepts like authentication, version, naming etc. For example Dropbox's API references files according to their path, whereas Box's API references files according to their file id (which has an associated path, but I believe remains the same if the file is moved). Then there's also all the issues of conflict resolution (aka merging) which come about when multiple clients try and sync conflicting changes to the server.
I've actually been recently considering starting an open source project to develop a library which can connect to all the major services, and provide an abstraction layer that papers over their differences, and also handles the syncing process for you. I've actually got some code already (which I haven't publicly released to date) but could use that to get the project started.
Would this be of use to you? Would you (or any others) be willing to participate in such an effort?
(note to mods: I realise this may be deviating somewhat off-topic - sorry about that. If you can recommend a more suitable forum to discuss this I'd be happy to take the conversation there).
There is a RSS feed that can be limited to one of the shared folders but it kind of filters events to keep volumes low.

Securing files on IPhone

Is there a way to decompile the binary from an IPhone app.
I jailbroke my IPhone and was surprised to find other app's dbs wide open to be copied.
So I exported my most important table and hardcoded it into code.
Instead of loading table into array from a db I just generated code to fill the array and kept only the most basic DB info so relationships still work.
Took a while but now works fine.
I was just wondering am I safe, could someone decompile the binary for the app easily and extract the data. In Java its easy to decompile *.class files though thats bytecode where I presume iphone apps are more low level.
I know IPhone sdk 4 can mark files as secure. Anyone know can this be overridden by jailbreaks or is this an unix lock?
Short of encrypting that data, you are really only protected by peoples lack of motivation. If someone with enough motivation wants to look at the data, they can. Even if you encrypt the data, if they key is in, or generated by, your code they can find that too.
To be honest Apple couldn't secure a brick. The iPhone has been almost continuously jail-breakable seance the beginning. Users (read hackers:) have more control over the device than developers. There is no way that you can truly secure content on the device. If encryption is used, there is nothing keeping the attacker from obtaining the key. (He has control over all libraries and can hook any function call he wants.)
It is common to see developers fall back on Security Though Obscurity, and I'm not going to entertain these ideas. If there is data on the device, a hacker can and will make a copy of it.
I jailbroke my IPhone and was
surprised to find other app's dbs wide
open to be copied.
No. There is nothing wrong with this. It has to be stored somewhere.
So I exported my most important table
and hardcoded it into code.
Bad move.
A jailbreak from a priviledge domain is a vulnerability in the phone and is not your problem. There is nothing you can do about that, and even encrypting your data will not save you because all privileged code on the phone will be able to access the encryption keys.
In other words:
Code will not normally be hostile and steal your goods. The only reason it would is because the user downloaded bad code onto the phone or a remote exploit took place.