Hey all. I tried posting this in the Scripting and the Asset Store forum, but wasn’t able to find a good answer, so I thought I would try here instead. I have a problem that I would like to resolve but am not sure exactly where to start. Essentially I have an asset that I’m working on that has extra behaviour supported if another one of my assets is included. Essentially I’ve boiled it down to the following example.
Asset 1:
namespace Package1 {
//The class that I want to extend from in my new asset
public class Class_A {
public int IntField;
}
}
Asset 2:
namespace Package2 {
public interface SomeInterface {
void DoAThing();
}
public class Class_B : SomeInterface {
public void DoAThing() {
Debug.Log("Does A Thing");
}
}
//This will cause compile errors if the user does not also have Package1.
public class SomeClass_A : Package1.Class_A, SomeInterface {
public void DoAThing() {
Debug.Log(IntField);
}
}
}
My question is essentially, how can I resolve the issue of determining if the user has Package1 or not? Essentially, I want to provide bonus functionality for people who have Package1, but it shouldn’t cause compile errors if someone only wants Package2. I know that some people have added support for other assets such as PlayMaker and I want to know how to do similar, but for my own packages.
Thanks for any help!