public static void PopulateAvailableScriptingDefineSymbolPredicateInfos() { List <ScriptingDefineSymbolPredicateInfo> predicateInfos = new List <ScriptingDefineSymbolPredicateInfo>(); foreach (Type type in ARSDK_SharedMethod.GetTypesOfType(typeof(AF_SDKManager))) { MethodInfo[] methodInfos = type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); for (int index = 0; index < methodInfos.Length; index++) { AFSDK_ScriptingDefineSymbolAttribute[] predicateAttributes = (AFSDK_ScriptingDefineSymbolAttribute[])methodInfos[index].GetCustomAttributes(typeof(AFSDK_ScriptingDefineSymbolAttribute), false); if (predicateAttributes.Length == 0) { continue; } if (methodInfos[index].ReturnType != typeof(bool) || methodInfos[index].GetParameters().Length != 0) { AFLogger.d((methodInfos[index].ReturnType != typeof(bool)) + " " + (methodInfos[index].GetParameters().Length != 0)); AFLogger.e(string.Format("The method '{0}' on '{1}' has '{2}' specified but its signature is wrong. The method must take no arguments and return bool.", methodInfos[index].Name, type, typeof(AFSDK_ScriptingDefineSymbolAttribute))); return; } predicateInfos.AddRange(predicateAttributes.Select(predicateAttribute => new ScriptingDefineSymbolPredicateInfo(predicateAttribute, methodInfos[index]))); } } predicateInfos.Sort((x, y) => string.Compare(x.attribute.SDKSymbol, y.attribute.SDKSymbol, StringComparison.Ordinal)); AvailableScriptingDefineSymbolPredicateInfos = predicateInfos.AsReadOnly(); }
static void SDKLoadInit() { BuildTargetGroup activeBuildTarget = ARSDK_SharedMethod.BuildTargetToBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget); #if UNITY_2019_2_OR_NEWER #elif UNITY_2018_1_OR_NEWER if (!PlayerSettings.GetPlatformVuforiaEnabled(activeBuildTarget)) { PlayerSettings.SetPlatformVuforiaEnabled(activeBuildTarget, true); } #endif if (PlayerSettings.Android.androidTVCompatibility) { PlayerSettings.Android.androidTVCompatibility = false; } PlayerSettings.iOS.targetOSVersionString = "11.0"; PlayerSettings.iOS.cameraUsageDescription = "Required for augmented reality support."; }
/// <summary> /// 配置单个识别图或者Model /// </summary> /// <param name="trackedName"></param> /// <param name="trackComName"></param> /// <param name="modelPre"></param> /// <returns></returns> public static Transform ConfigTrackable(string trackedName, string trackComName = "DefaultTrackableEventHandler", GameObject modelPre = null) { IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { if (tb.TrackableName == trackedName) { tb.gameObject.name = trackedName; //动态添加识别组件 tb.gameObject.AddComponent(ARSDK_SharedMethod.GetTypeUnknownAssembly(trackComName)); tb.gameObject.AddComponent <TurnOffBehaviour>(); GameObject augmentation = Instantiate(modelPre, tb.transform); return(augmentation.transform); } } return(null); }
private static bool IsVuforiaAvailable() { bool isLoad = ARSDK_SharedMethod.GetTypeUnknownAssembly("DefaultTrackableEventHandler") != null && ARSDK_SharedMethod.GetTypeUnknownAssembly("DefaultModelRecoEventHandler") != null && ARSDK_SharedMethod.GetTypeUnknownAssembly("DefaultInitializationErrorHandler") != null; if (isLoad && Loadstate == SDKLoadState.Loaded) { Loadstate = SDKLoadState.LoadAndInit; } else { if (isLoad) { Loadstate = SDKLoadState.Loaded; SDKLoadInit(); } else { Loadstate = SDKLoadState.UnLoad; } } return(isLoad); }