I’ve been playing around with Futile (a 2D framework for Unity) — including my last Ludum Dare entry. There’s not a ton of documentation and examples out there on the web (other than the source, which has most of what you need), and one thing I’ve run into a couple of times now is just setting up a new project. There are videos on the main futile site, but I personally can’t stand video tutorials (no way to search, usually go to slow, etc, etc). There’s also a great multi-part tutorial someone wrote about making Pong using Futile, but that one is a bit wordy and hand-holding (as it’s also explaining Futile as it goes). What I want is a really dead-simple cheat sheet for starting a new project, so here it is:
- Open up Unity and choose File -> New Project.
- Right click on “Main Camera” and delete it (you don’t need it).
- Either download the Futile zip, check it out from github, or copy it over from another project and put the entire Futile folder in your Assets folder.
- Make Resources and Scripts folders in your Assets folder (not strictly required but seems like a good convention) and copy any boilerplate code into your scripts folder (I re-use my base screen class and my asset loader)
- Switch back over to Unity and let it import all your scripts. Choose Game Object -> Create Empty from the menu. Change the name of this object to something more descriptive (not required, but helpful. i usually do “Futile” or the name of the game).
- Select the new game object and add the Futile Script as a component.
- Create a new MonoBehavior called YourApp.cs and attach it to the same node.
- Within the Start function of your app, paste in the Futile boilerplate setup code:
FutileParams fparams = new FutileParams(true,true,true,true); //landscape left, right, portrait, portraitUpsideDown fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, ""); //max height, displayScale, resourceScale, resourceSuffix fparams.origin = new Vector2(0.5f,0.5f); Futile.instance.Init (fparams); Debug.Log("HELLO WORLD"); //just so we know it worked!
That’s it! Now you should be able to build (and get a blank screen). You may also need to muck with your build settings a bit depending on what platforms you’re targeting, but at this point your project is set up and ready to go.