unity3d:vuforia根据dataset动态创建ImageTarget

2023-08-24 14:28:43 浏览数 (1)

代码语言:javascript复制
    void CreateImageTarget()
    {
        IEnumerable<TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours();
        foreach (TrackableBehaviour tb in tbs)
        {
            Debug.Log(tb.TrackableName);

            tb.gameObject.name = "ImageTarget";
            //下面这两句不能少,需要给它加上这两个组件
            tb.gameObject.AddComponent<DefaultTrackableEventHandler>();
            tb.gameObject.AddComponent<TurnOffBehaviour>();
        }
    }

0 人点赞