ARCore + Unity + Augmented Images - Load different prefabs for different Images

前端 未结 2 1888
后悔当初
后悔当初 2020-12-17 07:19

How do I assign different prefabs to different images?

right now, I have all my prefabs loading in on top of each other but how do I get it so each prefab loads in o

2条回答
  •  眼角桃花
    2020-12-17 07:46

    I assign different prefabs to different images by this way:

    • I modified the AugmentedImageExampleController.cs:.
    • I added a list for prefabs:

    public List prefabs = new List();

    • For the related image for the prefab I did a reference by using the image.DatabaseIndex in the visualizer:

    visualizer = (AugmentedImageVisualizer)Instantiate(prefabs[image.DatabaseIndex], anchor.transform);

    In the inspector of ExampleController you can put in the prefabs (AugmentedImageVisualizer) now.

    That's it, and its working fine!

提交回复
热议问题