“A scroll view that tries to reveal its content, how utterly pointless.”
— Matthew Miner
Today’s Unity discovery: calling Event.Use() every time the OnGUI() function runs will cause scroll views to not work. At least, they won’t respect any dimensions you set and will simply stretch to accommodate the elements contained within it. “A scroll view that tries to reveal its content, how utterly pointless.” Those were my exact words.
In code form, I had something like this:
Vector2 scroll;
void OnGUI () {
scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Width(50), GUILayout.Height(200));
GUILayout.Label("I like big labels and I cannot lie. You other brothers can't deny.");
EditorGUILayout.EndScrollView();
if (Event.current.type == EventType.KeyDown) {
Debug.Log("You've pressed a key. Righteous.");
}
Event.current.Use();
}
The scroll view is most certainly not 50 pixels wide. Moving Event.current.Use() inside the if statement fixes it though.
if (Event.current.type == EventType.KeyDown) {
Debug.Log("You've pressed a key. Righteous.");
Event.current.Use();
}
And all is well.
“Shouldn't you be done by now?”
— Harold K. Bullard
A new requirement for the Summer of Code is to give weekly progress reports detailing what we’ve accomplished in the past week as well as what we intend to conjure up in the next one. I figure to give the old blog some love, I’d post my progress reports here.
Week 1
- Determined desired features
- Fleshed out media metaphors presented to user (shots, actors, audio and subtitles)
- Basic user interface setup
- Researched animations and animation events
Week 2
- Classes: media, tracks, clips are objects
- Media can be added to timeline
- Playback: camera toggling, audio and subtitles
- More user interface setup
- Custom inspectors
- A scrubbable timeline
- Drag and drop media from project Hierarchy and Assets view
- Reviewed third-party code contribution
Week 3
- Add ability to add actors
- Clip editing: drag clips to a new position on timeline
- Manage overlapping elements
- Make a zoomable timeline (currently it’s at a fixed zoom level)
- Razor tool
“I hope your software is of higher quality than your analogies.”
— Bill Bowerman
Work on the Cutscene Editor has been progressing steadily. The GUI is starting to come together and actually resemble a cutscene editor (whatever the heck that looks like; I conveniently have no point of comparison). Building the editor window controls has been frustrating at times, but ultimately rewarding. Frustrating because the documentation can leave much to be desired. Rewarding because the ability to extend the editor is sensational. It’s like a roller coaster, but it code form and without the long lineups.

Above is a screenshot of the current version. Let’s call it 0.1. If it looks terribly unusable, that’s because it is. But don’t you fret, it will be awesome.
“I would have pitched a Hello Kitty GUI skin. Way more useful than a friggin' cutscene editor.”
— Olof Öhman
Today I was accepted into Unity’s Summer of Code. In their wise words, it’s “a program through which we offer indie & student developers the chance to get paid for doing something cool in Unity.” Applicants pitch an idea and if it’s accepted they get cash, a mentor, and six weeks to complete their project. It’s a rather fine program I reckon — there’s some intimidating talent in the Unity community and a never-ending need for more Awesome Stuff.
My particular idea was to create a Cutscene Editor to facilitate easy creation of realtime cutscenes by developers and filmmakers alike. Think of it as merging Final Cut with Unity, but working with in-game cameras and animations rather than video footage. Creating cutscenes in Unity is currently a bit of a drag and requires the developer to whip out their trusty script editor. The goal of this project is to make such whipping unnecessary, and to make it possible for video editors to work with elements like clips, transitions, and effects in a familiar way. If this sounds interesting to you (and I sincerely hope it does), I encourage you to take a look at my proposal [PDF].
Over the next six weeks I’ll be posting about my progress here and on the forum. Naturally I’d love to hear any feedback and ideas you might have. My development time is fairly limited, but in the given month and a half I hope to make this tool as useful as possible.
“I was once in a musical. I played every character, including the dog.”
— Philip Banks
For my final project at Vancouver Film School, I created a short comedic musical titled The Contrivance of Dr. Bromegrass. It tells the tale of a lovable mad scientist who has his medical license revoked after performing unorthodox experiments. He finds himself losing hope in his work until inspiration comes in the form of his idol, Thomas Edison. To gain back the respect of the scientific community, he seeks to come up with the Ultimate Scientific Creation. I went all experimental and included credits at the end. Nobody does that these days.
Now that I’ve ruined the plot, I figure releasing the script won’t cause any more damage. While the film can’t be shown just yet (doing so could make it ineligible for some festivals), I invite you to check out the text version of the movie [PDF].
In the future I reckon I’ll make a post about my experiences making a musical. It was certainly a challenge, but most definitely worth it. Every movie should be a musical.
“The written word pales in comparison to what can be expressed using construction paper.”
— F. Scott Fitzgerald
One of my first assignments at Vancouver Film School was to tell a short story using a series of images, limiting the use of narration. This could be done using drawings or photographs or any other visual medium. I chose to tell my tale using characters cut from construction paper. Each “shot” was taped to the wall then photographed. It was tedious compared to using something like Photoshop and that newfangled cut ‘n paste I hear so much about, but the end result was decidedly worth it.
Some Things Are Unforgivable tells of a handsome young egg-shaped creature sharing a portion of his past with his parents. It can be viewed right here [PDF].
“XML? Ha! I once wrote some XML! Hilarious!”
— Juan José Pérez Hernández
This winter I built a basic video player for a website using Adobe Flex. Beside the viewer was a list of thumbnail images, one for each video. When clicked on these would load the appropriate video and display relevant information below the viewer. This information, as well as the paths to the videos and thumbnail images, was stored in an external XML file. The player worked well, perhaps even excellent, until some of the information in the XML file was changed. The video player still worked, but the new information was nowhere to be found. Below is the tag I used to load the XML data.
<mx:XML id="vidXML" source="videos.xml" format="e4x" />
To my surprise, using this tag causes the XML data to be compiled into the .swf rather than loaded at runtime. Making a change to videos.xml didn’t do a thing — indeed, it wasn’t even necessary that the XML file exist after compilation.
Now, this is not the behaviour I desired. I wanted to allow others to modify the contents of the XML file and have their changes reflected in the SWF. The solution was to not use the Flex XML tag at all, but rather to use the following code.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="xmlReq.send();">
<mx:HTTPService id="xmlReq" url="videos.xml" resultFormat="e4x" result="toXMLFormat(event)" />
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
private var vidXML:XML;
private function toXMLFormat(event:ResultEvent):void {
vidXML = event.result as XML;
}
]]>
</mx:Script>
</mx:Application>
I’m relatively new to the Flex game, so this may seem obvious to veterans in the field, but for new Flexers (Flexies? Flexettes?) it’s perhaps something to take note of. I sure wish I had.
Sigh.
“Please stop butchering our song. I'm begging you man, just quit doing it. Please.”
— Kool & The Gang
Recently I built a browser-based window system using the most excellent MooTools JavaScript framework. It behaves similar to how your modern desktop windows work. That is, windows can be opened, closed, resized, and dragged around by their titlebar. When clicked on, a window will come to the front of the window stack. It’s a lot like the Mocha UI project, just not as good (mad props to the creators of Mocha, it rocks hard).
Anyway, to the point of this post: in one of these windows I later embedded a Unity game. Much to my dismay I discovered that having a div hovering over an embedded Unity game doesn’t work — the div will appear behind it, despite having a higher z-index. This means that I can’t have my windows properly overlapping each other, and any thought of decorating a Unity game (giving it rounded corners, perhaps) can be forgotten.
I’m told by intelligent people that this behaviour can be expected with any embedded object (Flash excluded). So, what’s the solution? Unfortunately there isn’t one that I’m aware of. As nice as it would be to place wacky animated GIFs overtop a well-polished Unity game (bring back 90′s web design!), you’re simply out of luck. Or I’m simply out of luck. Somebody is simply out of luck.
“Stylesheets that won't render are more tragic than Romeo's inability to check a pulse.”
— R.B. Bennett
Two months ago I designed a website for the company I’m currently employed at. The site was pretty basic fare — four or five HTML pages, a few images, and a stylesheet to make it look sexy. The design was uploaded to the development server then uploaded to the live server once approved. All was well until the site was viewed in Firefox (I can’t recall how Safari and Opera behaved). For a reason unknown to all of us fine employees, the styles in the CSS file weren’t being applied. The .css file was most certainly there, and Internet Explorer displayed the site just peachy. Most perplexing was that the development server and live server are supposed to be identical, and no such wonkiness occurred on the dev side.
Luckily the problem was found quickly by one of my co-workers. Our live server is apparently powered by Netscape Enterprise Server, which came configured to serve .css files with the application/x-pointplus mime type (not good Netscape, not good at all). Some web browsers like Internet Explorer will ignore the server and treat the CSS file as text/css while others like Firefox will roll with application/x-pointplus and potentially show you a website that looks disastrously grotesque.
I’m not sure how popular Netscape Enterprise Server is, but if you happen to be using it and browsers are ignoring your stylesheets, make sure that your .css files are actually being served with the text/css mime type. Because that just makes sense.