Sunday, May 19, 2013

OpenInFileBrowser Code

I realized there's a debacle right now in the Unity Wiki Website over its content being under the Creative Commons License.

So to make sure there's no legal problems with using this code, here's a re-upload of my OpenFileInBrowser code for Unity here in my blog.

As always, I put this code in Public Domain as it's quite simple but good enough to be shared.


public static class OpenInFileBrowser
{
   public static bool IsInMacOS
   {
      get
      {
         return SystemInfo.operatingSystem.IndexOf("Mac OS") != -1;
      }
   }
 
   public static bool IsInWinOS
   {
      get
      {
         return SystemInfo.operatingSystem.IndexOf("Windows") != -1;
      }
   }
 
   [MenuItem("Window/Test OpenInFileBrowser")]
   public static void Test()
   {
      //string path = "/Users/Ferds/Unity Projects/BuildReportTool/BuildReportUnityProject/Assets/BuildReportDebug";
      //string path = "/Users/Ferds/Unity Projects/BuildReportTool/BuildReportUnityProject/Assets/BuildReportDebug/EditorMorel.log.txt";
      //string path = "/Users/Ferds/UnityBuildReports/";
      string path = "/Users/Ferds/UnityBuildReports/test4.xml";
 
      Open(path);
   }
 
 
   public static void OpenInMac(string path)
   {
      bool openInsidesOfFolder = false;
 
      // try mac
      string macPath = path.Replace("\\", "/"); // mac finder doesn't like backward slashes
 
      if (Directory.Exists(macPath)) // if path requested is a folder, automatically open insides of that folder
      {
         openInsidesOfFolder = true;
      }
 
      //Debug.Log("macPath: " + macPath);
      //Debug.Log("openInsidesOfFolder: " + openInsidesOfFolder);
 
      if (!macPath.StartsWith("\""))
      {
         macPath = "\"" + macPath;
      }
      if (!macPath.EndsWith("\""))
      {
         macPath = macPath + "\"";
      }
      string arguments = (openInsidesOfFolder ? "" : "-R ") + macPath;
      //Debug.Log("arguments: " + arguments);
      try
      {
         System.Diagnostics.Process.Start("open", arguments);
      }
      catch(System.ComponentModel.Win32Exception e)
      {
         // tried to open mac finder in windows
         // just silently skip error
         // we currently have no platform define for the current OS we are in, so we resort to this
         e.HelpLink = ""; // do anything with this variable to silence warning about not using it
      }
   }
 
   public static void OpenInWin(string path)
   {
      bool openInsidesOfFolder = false;
 
      // try windows
      string winPath = path.Replace("/", "\\"); // windows explorer doesn't like forward slashes
 
      if (Directory.Exists(winPath)) // if path requested is a folder, automatically open insides of that folder
      {
         openInsidesOfFolder = true;
      }
      try
      {
         System.Diagnostics.Process.Start("explorer.exe", (openInsidesOfFolder ? "/root," : "/select,") + winPath);
      }
      catch(System.ComponentModel.Win32Exception e)
      {
         // tried to open win explorer in mac
         // just silently skip error
         // we currently have no platform define for the current OS we are in, so we resort to this
         e.HelpLink = ""; // do anything with this variable to silence warning about not using it
      }
   }
 
   public static void Open(string path)
   {
      if (IsInWinOS)
      {
         OpenInWinFileBrowser(path);
      }
      else if (IsInMacOS)
      {
         OpenInMacFileBrowser(path);
      }
      else // couldn't determine OS
      {
         OpenInWinFileBrowser(path);
         OpenInMacFileBrowser(path);
      }
   }
}

Wednesday, May 8, 2013

My first time selling on the Unity Asset Store

It started with this. Someone was having trouble with his build size so I explained that thing about the Editor.log, in that it actually had info on the breakdown of your build's file size!

So I went and whipped up a simple front-end for the log's build info over a weekend.


Then I asked the forums if they'd be interested in having it on the Asset Store. A handful of people agreed. Then I thought, why don't I try selling it, maybe for just a few bucks to see what's the experience of selling on the Asset Store? We need the money anyway.

There was a discussion in a LinkedIn Unity group where someone was adamant that I should give it for free and that I'd only get a few bucks out of it. It was quite a bummer. It was a bit depressing actually.

So I set it to $2 as an introductory price and waited how it would turn out. The plan went that I'd keep it as $2 for one week then set it to the standard price.

David Helgason even retweeted my tweet about it. I guess it was like... I don't know. Stevie Wonder humming a tune you just made up? It was unexpectedly cool.

David's a pretty awesome guy.

I placed a public poll on my forum thread asking "How much would you be willing to pay for this plugin?" The choices I put where $2, $5, and $10. Majority answered $5. I guess they're not that cheap that they'd settle for the lowest price. Seems like $10 is too much too. So we figured $5 was the sweet spot.

By the end of the week I then set it to $5, only to realize that price changes do, in fact, still have to go through review by the Asset Store team. Then David again helped me out. It's quite awesome that a big company like Unity still has the time to help out the little guys using their products.

So the $2 sale went for approximately 9 days. A total of 117 people bought it during that period.

I'd shudder to think that $163 is only a few bucks. Must be there's a really high standard of living where that guy is.

Now that the selling price is $5, the amount of people who purchased is about 1/3rds lesser. I still got higher sales overall though.

It's selling quite well, for something I just whipped up over the weekend (though I do improve it every now and then). It's managed to get consistent five stars from reviews. It even got to the Asset Store front page one time.


Here's the link to the Asset Store page: http://u3d.as/4u2

Here are some things I'd like to share for my experience:

  1. If a customer previously purchased directly from you (not from Asset Store), it cannot be unlocked for them in the Asset Store for free. They have to buy it again in the Asset Store.
  2. Your publisher page is quite bare-bones. There's no sales graph or overall total sales. There's only the sales per month, and you can only view one month at a time. Switching from one month to the next is quite slow (for my Internet connection).
  3. Related to that, when a customer posts a user review, you get no email notification about it, or any notification whatsoever. You have to visit your asset store product's page every now and then to see if someone has a complaint in their review, or some misunderstanding you'd like to clear up. UT's take on this is that it's your job to facilitate communication with your customers, but something like an option for email notification in this case would be nice, no?
  4. The ways you could offer support is usually via Twitter, email, tell them that they can PM you in the Unity forums, or if you have a forum thread about your product, give them a link. You'd usually put such links in your Asset Store product page's description.
  5. I'd like to reiterate the standard warning: If enough customers complain that they are not getting adequate support from you, UT has the right to take down your product.
  6. If your product is something visual, then potential customers will like to see video demos, or web interactive demos to see an example of how your product is useful. Their mindset is: "So what's this Asset Store package? Will it be useful in the project I'm working on?" That second question is what you need to address. And you do it by showing potential scenarios of how it's used, i.e. demos.
  7. If your product is purely code instead, perhaps a video tutorial how to use it can also work. At the very least, post some screenshots. Surely there's something visually presentable that you can show?
  8. If your asset store package has code, customers will appreciate it if you separate your code into your own namespace as much as possible to avoid name conflicts.
  9. Use the lowest possible version of Unity when releasing your asset package. Since they are distributed as .unitypackage files, the version of Unity used to create the .unitypackage is also the lowest version allowed to import that file. Frankly, I think this is just a conspiracy to force you to upgrade your licenses. I keep an installation of Unity 3.5.3 in this case.
  10. Selling on the Unity Asset Store is a non-exclusive deal. I.e. you are free to sell your product via other stores (ex. gameprefabs.com)
  11. You can't verify if a person who emailed you really purchased your product just using your publisher dashboard alone. You can, however, email the Asset Store Team to verify for you if someone indeed purchased it. Dantus in the Unity forums points out email isn't necessary. All you need to do to verify if someone purchased your asset is to ask them for their Invoice Number. Then in your publisher dashboard, there's a tab called "Verify Invoice". You can type the Invoice Number there to verify someone's purchase. (For example, say, someone reported a bug. So you fix it and would like to send it to the bug reporter to test the fix on his machine. What if he didn't really purchase your product? You better verify to be safe.)
  12. Possible places you can use to advertise your asset package:
    1. Main Unity Forums
    2. Google+ Unity Community
    3. LinkedIn Unity Group
    4. Unity South East Asian Mailing List (only if you're based in South East Asia!)
    5. Unity3d Subreddit