General And Unity Game Related programming tutorials and code repository

Expandmenu Shrunk

  • Unity Plugin Project Code.

    In my haste to get code up for you guys, I found the folder that I was sure contained the completed projects for my videos.

    I pushed it up to github, thinking that would give everyone what they needed… Boy was I wrong.

    the OSX code seems to have been omitted because it had a .git repo of its own. And I apparently dont have the C# version anymore at all.

    I have posted up the latest code for the projects that I was able to locate, Unfortunately I have not had the chance to test them.

    I did however notice that the project did not include the OSX Callback code that emulates “SendMessage” which means I will need to relocate, or redevelop the code for the repo.

    I apologize for the issues, The machine I originally developed it on I have been relieved of.

    Here is the link to the existing code.

  • Unity3D Code Obfuscation

    I have decided to build a unity3d obfuscation utility.

    Most of the obfuscation tools I have found are either too obfuscating to work with Unity because of its loose coupling, or too weak of an obfuscator and really misses a lot of the Business logic that needs to be prevented from altering and viewing.

    Therefore I have been working on building my own obfuscator. There are a lot of good resources out there, but the biggest thing they miss is the one off developers that need something a little more customized. Giving the developer control over the obfuscation is usually Taboo, because its your intellectual property, if you let others have the power to perform the same thing than you have worked yourself right out of the time you spent making the obfuscator, However my lazy nature makes me want to build something that people can alter on their own.

    If anyone has thoughts on this, Email me at and tell me what you think is missing, or maybe you really like a project that is out there, tell me what you think

    If you feel this is a worthy cause, you could totally donate a cup of coffee or lunch. :)

    This is what I have been able to produce thus far.

    for testing purposes I am building my obfuscator using GUID renaming. To ensure complete uniqueness.
    However I will be building a unicode character name generator for this project as well. (Everyones favorite)

  • Unity Plugins on Mac OSX

    I have been building plugins for a lot of different needs, but my biggest headache with mac OSX has been that whenever I use a plugin, Whether through dlopen or DllImport the application hangs when closed. the only way I could close the app was to “Force Quit” and wait.

    Well no longer. I’m really tired of mac getting the better of me. So I built a “Destroy” method on my plugins.

    No need to destroy each plugin, this destroy method is for when I am about to close the application.


    I was really trying to avoid this type of fix, but there’s not much else I can think of.

    Here is a sample of my plugin.

    Exports Header file.

    Exports Implementation file.

    As you can see I called exit right int the C++ implementation file.

    as for HookWindow, In case you were interested.

    HookWindow Header file

    HookWindow Implementation File

    Finally is the Unity Scripts.. First we will do the Dll Bridge implementation.

    And finally the Static Script that will get the application exiting message.

    you will see the Destroy call on Line 17.

    but you will also see on line 10 that I told it no to destroy. This will keep this script floating around on the game object it is attached to until you close the application.

    Im sure there is a better way than this, but this fixed the problem for me. I hope this can help others.

  • DllImport vs LoadLibrary/dlopen

    DllImport is supposed to have a direct correlation with LoadLibrary, and subsequently dlopen on mac/linux. However with unity, there are a few api calls that Unity forwards to you when you start your app and when you ask for a render call.

    Adding the following exports

    extern "C" void EXPORT_API UnitySetGraphicsDevice (void* device, int deviceType, int eventType);

    extern "C" void EXPORT_API UnityRenderEvent (int eventID);

    will enable unity to send your plugin Graphics and Render calls. However this only seems to happen if you use DllImport, not when you use dlopen or LoadLibrary.

    Currently this is just something to note. I am going to be working on a way to get the plugin back into the render pipeline, If I can.

    Also, I will be testing the render pipeline on iPhone and Android testing out some in game Movie Textures.