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!