2

I have this code:

m_FacebookVersion =  Facebook.Unity.FacebookSdkVersion.Build;

To get the version of Facebook, but I run into problems when Facebook doesn't exist. I can't find a Define to check against i.e. #if UNITY_EDITOR.

I also tried

Type myType = Type.GetType("Facebook.Unity.FacebookSdkVersion");

But myType returns null.

Any suggestions?

Thanks

Dave w
  • 21
  • 3

1 Answers1

0

After some digging, I came up with this:

        m_FacebookVersion = "N/A";

        Type myType = Type.GetType("Facebook.Unity.FacebookSdkVersion, Assembly-CSharp");
        if(myType != null)
        {
            PropertyInfo myProp = myType.GetProperty("Build");
            if(myProp != null)
            {
                m_FacebookVersion = (string)myProp.GetValue(null, null);
            }
        }

Seems I needed to look in a different Assembly.

Dave w
  • 21
  • 3