Topic: Generating a Tour at runtime

I am working on trying to generate a Tour dynamically at run time. The system I have built out works great if I generate the Tour items in editor, but there seems to be a referencing issue otherwise. Couple problems I am having, and have avoided a bit is making sure the uPano Tour Object, and at least one Tour Item is appended into it, otherwise there is several null references. I am generating the panos with this following code, and the cameraType/existingCamera do not get properly set in the scene graph, and default to "createNew".

void MyPanoGenerator(Tour tour){
    TourItem item = TourItem.Create(tour);
    Pano pano = item.gameObject.GetComponent<Pano>();
    pano.cameraType = Pano.CameraType.existing;
    pano.existingCamera = Camera.main;
    SphericalPanoRenderer spr = item.gameObject.GetComponent<SphericalPanoRenderer>();
    spr.radius = 100;
    //....etc
}

This does work fully IF this method is run in editor (before hitting the play button). Is there a method I need to use to update the pano with the new context, or another construction method I should use?

Thank you for you help

Re: Generating a Tour at runtime

Hello.

I just tested dynamic tour creation and it works correctly on my side.
Here's a video about it:
https://www.dropbox.com/s/r2si52bkbp7xc … r.mp4?dl=0

If you have any exceptions on uPano side, please show the code that causes the exception.
I will check and fix all the problems on our side, or explain what is wrong on your side.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Generating a Tour at runtime

Was the cameraType/existingCamera being properly maintained in the scene? With this method it returns back to createNew.

Re: Generating a Tour at runtime

Now I see the problem.
Thanks for showing me this.

To fix this, modify Pano.cameraType property:

public CameraType cameraType
{
    get { return _cameraType; }
    set
    {
        if (_cameraType == value) return;
        
        if (_camera != null)
        {
            if (_cameraType == CameraType.createNew) Destroy(_camera.gameObject);
            _camera = null;
        }

        _cameraType = value;
    }
}

The next version of uPano will contain this fix.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.