The Script appended with GameObject which Instantiate from AssetBundle.Load() doesn't work

In project M,I write a virtureclass in C# Like this

public class A : MonoBehaviour
{

public virtual int Building()
{
    print("this is bad");
    return 0;
}

}

In project N,Copy the file,and wirte a new class B like this

public class B: A
{

public  int Building()
{
    print("this is ok");
    return 0;
}

}

Then I make a prefab in project N,named c ,appened the script B, and make a AssetBudle.
I load the prefab c use WWW.assetBudle.Load(“c”) in the project M webplayer.
When I call the Building method with gameOject.GetComponet() as A,or gameObject.SenMessage(“Building”),it failed.
But,if I copy the class B file to project M,gameObject.SenMessage(“Building”) and gameOject.GetComponet() both OK.
I don,t want to write all class in project M then copy them in project N.I want to write a class A in project M . And write many class in project N ,inherit from class A,as I need.How to do it? Thank you,every one!

Your mistake is that you don’t override the Building method in B. You’re hiding the original method which leads to that you reimplement the method in B. So your class has two unrelated methods with the same name. You have to use override in B to actually override the method and to make it dynamically linked.

public class B: A
{
    public override int Building()
    {
        print("this is ok");
        return 0;
    }
}