Phaser es6/webpack + PhaserInput

Lately I’ve been trying to work a little bit more with Phaser in my free time since we use it a work a bit.

Luckily for me, Leandro Cabrera has created a boilerplate project which allows me to write and structure phaser games in a sane way.

Also luckily for me, Azerion maintains a plugin for a feature that I feel should just be part of Phaser’s core, text input.

Unluckily for me, these two code bases do not like play together out of the box.

After a bit of googling around I found several posts where people were encountering the same problems as me but none of the solutions worked.

Luckily a few posts provided a starting point and I was finally able to get them to play together.

Firstly in our webpack.config.js we need to make some edits to our module rules and alias objects

module: {
    rules: [
      { test: /\.js$/, use: ['babel-loader'], include: path.join(__dirname, 'src') },
      { test: /pixi\.js/, use: ['expose-loader?PIXI'] },
      { test: /phaser-split\.js$/, use: ['expose-loader?Phaser'] },
      { test: /p2\.js/, use: ['expose-loader?p2'] },
      { test: /phaser\-input\.js$/, use: "exports-loader?PhaserInput=PhaserInput"}
  node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
  resolve: {
    alias: {
      'phaser': phaser,
      'pixi': pixi,
      'p2': p2,
      "phaser-input": path.join(

Then in our Boot state (or where ever, I just like plugin initialization there), we can import the class like this :

import PhaserInput from'phaser-input'

And finally in our init we add the plugin to Phaser;

The double PhaserInput when adding the plugin in more than a little annoying but at the moment I’m just happy to have these two necessary code bases working together

Unity missing custom initializers

One of the things I miss the most coming from Objective-C to Unity is the lack of custom initializers. Luckily-ish there is a way to kind of do this:


public class Meow()
    public int x
    public string name

new Meow{x = 10, name = "cat"}



Fastlane build numbers for Unity

Recently on a project, I came across a problem where the Fastlane Unity action I am using was blowing away the info.plist of the generated xcode project despite the Unity project being marked as “Append” instead of “Replace”.

The reason this is a problem is we wanted each build to be uploaded to hockey app with a unique build number. Fastlane has plugins to handle this but it depends on the info.plist not being destroyed.

So there’s a simple hack to fix this. Use a small ruby function in the fastlane file to write your version to a file and update each time the file is ran.

Here’s a snippet:

build_num = 1
filename = "build_number"
if File.exist?(filename) { |f|
    build_num = + 1
end, "w") { |f|

When you want to get your version number you simply just :

file ="build_number", "r")
build_num =

And Bob’s your uncle.

Image pinch zoom and swipe in Unity

Currently, I am working on a glorified slideshow for an app that I am rebuilding in Unity. After very little effort on my part, I was unable to find a slideshow framework I liked or a plugin that handled input the way I wanted.

So I just made it the way I wanted it to behave. It’s pretty straightforward. The only thing of interest in that I am using MouseDown for the swipe vs GetTouch for the pinch. This was so I could test the swipe in the editor. If I used GetTouch instead I wouldn’t need the Invoke function for blocking swipes during a pinch.


Simply deploy and view Unity logs on Android

Having to plug your phone into your computer every time you want to test your game or app on android sucks.

Luckily there is a simple way to do it.

  • Add adb to your path variables.
  • Connect your phone to your computer
  • In terminal run: adb tcpip 5555
  • Disconnect phone
  • Find phones IP address: Settings > About phone > Status
  • In terminal run: adb connect IP_ADDRESS
  • Confirm connection in terminal with:  adb devices

Boom. Device connected. Now in Unity when you hit Build & Run it will deploy right to device.

“But what about logs?” you may ask. In terminal run adb logcat -s "Unity".

Unnecessary phone permissions when build react native android

Yesterday when trying to release a simple app to the android store, I noticed that my apk was requesting phone permissions and this was requiring me to use a privacy policy on the play store.

After some digging I came across this comment on the react native github page and it solves it for me. Hopefully this will help other until they manage to resolve this issue



Git ‘cherry-pick’ individual file

Today the situation came up where I wanted the latest of a file in another branch. But only that file. Didn’t want to merge and reject so that get’s rid of cherrypick and merge as options.

Luckily there is a way to do this just using the checkout command.

[code]git checkout feature/meow Source/Cat.cs[/code]


Sauce :

Get a patch file from a github commit

Writing this mostly so I don’t forget.

Let’s say you want a patch file of a particular commit, for example:

Append .patch to the end of that ( ) and you have yourself a patch file!


Grouping signals in StrangeIoC

Recently I have started relearning Unity3d and because I very much enjoy DI and IoC I’m also relearning StrangeIoC. Since I’ve last looked at Strange, Signals have been added. This makes me very happy being an old AS3 dev that <3’d Robotlegs and AS3Signals.

Anywho, one “problem” with signals, that existed in flash as well, is that each signal is a class. The idea of making a 5 line class for each signal I want to dispatch irks me. My solution is an ugly one but I liked it when doing flash and so far like it here as well.

namespace ca.openbracket.signals{
    public class StartSignal:Signal{}
    public class TestSignal:Signal{}

What I like about this approach is that I can group my related signals into a single file and see them all.  The two big drawbacks are searching for a signal can be difficult if you aren’t accustomed to this and you don’t get more granulated version control details.

Is this worth it? I have no idea. But it makes me happy.

Font ascender’s cut off for custom fonts on ios7

Just look at that title. What a stupid bug.

Anyways, in one of the apps I work on we were seeing on ios7 that a custom bold font was clipping the ascenders on all uppercase characters. After some googling I found that it was an ios bug.  I luckily found a nicer way to correct the issue than having to increase the height of each textfield by 6 pixels and offsetting it’s ypos.

This post describes using the OSX Font Tool to pull the measurements from the font and allow you to edit them. So by setting the lineGap to 0 (the ios bug is that lineGap is ignored :/ ) and adding that amount to ascender you can fix the problem. I haven’t had design sign off on this yet so I’m not sure if it’s perfect but it works and looks pretty good to me


::MARCH 31st EDIT::

So the artist and I looked at the font change and it doesn’t work for our needs. Yes, it fixes the issue, but our text is not not in the right position and since only one field if effected we chose to just increase the height of the field and change its offset.