示例#1
0
 public void LoadPrefab()
 {
     //加载Resource路径下的Prefabs
     Res.Add(Instantiate(
                 resLoader.LoadSync <GameObject>(ResFromType.ResourcesRes, "ExampleRes/Models/OxygenTank", DestroyCache: true)));
     AFLogger.d("从Resources加载并实例化了" + Res.Count + "个");
 }
 private void Update()
 {
     if (!isARReady && isDataSetReady && CameraDevice.Instance.IsActive() && TrackerManager.Instance != null)
     {
         isARReady = true;
         foreach (OneDataSetInfo oneDataSetInfo in oneABClassInfo.dataSetInfos)
         {
             AFSDK_DataSetHandle.LoadDataSetFromPath(PathTool.PersistentDataPath + "/" + oneDataSetInfo.TargetDataSet + ".xml");
             List <string> targetInfo = new List <string>(oneDataSetInfo.TargetInfo.Keys);
             for (int i = 0; i < targetInfo.Count; i++)
             {
                 if (oneDataSetInfo.TargetInfo[targetInfo[i]].oneResInfo.ResPath != "")
                 {
                     GameObject objPrefabs = resLoader.LoadSync <GameObject>(ResFromType.ABRes, oneDataSetInfo.TargetInfo[targetInfo[i]].oneResInfo.ResPath);
                     Transform  trans      = AFSDK_DataSetHandle.ConfigTrackable(targetInfo[i], modelPre: objPrefabs); //生成模型
                     if (oneDataSetInfo.TargetInfo[targetInfo[i]].oneResInfo.isUseConfig)
                     {
                         trans.localEulerAngles = oneDataSetInfo.TargetInfo[targetInfo[i]].oneResInfo.ResRotation;
                         trans.localScale       = oneDataSetInfo.TargetInfo[targetInfo[i]].oneResInfo.ResScale;
                         trans.localPosition    = oneDataSetInfo.TargetInfo[targetInfo[i]].oneResInfo.ResPostion;
                     }
                 }
             }
         }
     }
 }