How to check if other Asset exists?

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!

You should be able to use Reflection for this.

From this Stackoverflow answer

var instances = from t in Assembly.GetExecutingAssembly().GetTypes()
            where t.GetInterfaces().Contains(typeof(ISomething))

That will get all of the types in the executing assembly, then get a list of interfaces to see if any of them are a specific interface type. This probably isn’t exactly what you’re looking for, but it kind of gives you a good place to start exploring.