How does iTween extend the GameObject class?

Hi,

I saw this extension for iTween:

http://itween.pixelplacement.com/nativeExtension.php

And I wonder how did they go about adding new functions in the GameObject class?

This is how I would add new functions to a class: (Theoretically, I haven’t tested it with MonoBehaviour)

public class MyMonoBehaviour : MonoBehaviour

MyMonoBehaviour inherits MonoBehaviour and all of its functions, you could then add functions into MyMonoBehaviour extending MonoBehaviour, but do be sure that all of your scripts (that would normally inherit MonoBehaviour) is changed to inherit MyMonoBehaviour so you get all the functions you added.

It is done using a C# Extension method. They allow you to add additional functionality to a class without directly modifying or accessing that class.

http://www.codeproject.com/Articles/271683/I-Love-Csharp-Extension-Methods