Tag Archives: Futile

Dev Log 1/11/2013

This evening I worked on basic boiler plate stuff. I put some stuff up on github including Futile QuickStart I even made a pull request for Futile.
I pretty much spent the rest of evening fighting my font code. Fonts took way too long because I though I was running the latest version of Futile, but it turned out I wasn’t. I got confused about my github pull and which package I imported. Exactly, one of those things that bugs me about the way github’s and Unity’s idiosyncrasies interact. Anyway, once I figuring that out, Futile gave me a useful error that nicely explained what the problem was, oh hum.

Futile Quick Start

Futile is a framework that allows you to control rendering within Unity programmatically. This is a boon to anyone interested in 2D games and finds, like myself, that Unity impedes 2D game development.

  1. Get Futile from Github
  2. Import the Futile.unitypackage into you Unity project, Assets->Import Package->Custom Package…
  3. Create an Empty GameObject and call it Futile Camera, GameObject->Create Empty
  4. Find the Futile script in the Project Pane and drag it to the Futile Camera object you just created.
  5. Make or find a fun and silly image, I like this one: OMG IT SPINS
  6. Now put it in you Unity project under the Asset folder and call it OMG.
  7. Click on the image and set the Texture Type to Advance and then the Non Power of 2 to None.
  8. Create a new Script file and name it FunWithFutile.cs and drag it to the Futile Camera object.
  9. Now copy the code below into you script file.
    using UnityEngine;
    public class FunWithFutile : MonoBehaviour
    {
        // Use this for initialization
        void Start()
        {
            FutileParams futileParams =
                new FutileParams(true, true, true, true);
            futileParams.AddResolutionLevel(
                1024, 1, 1, "");
            futileParams.origin = new Vector2(
                 0.5f, 0.5f);
            Futile.instance.Init(futileParams);
            Futile.atlasManager.LoadImage("OMG");
            FSprite fSprite = new FSprite("OMG");
            Futile.stage.AddChild(fSprite);
        }
        // Update is called once per frame
        void Update()
        {
        }
    }
  10. Press play and be impressed!