1 (edited by philzmz 2020-04-08 13:25:10)

Topic: Texture doesn't change the 3rd time ???

Hello,

I have an issue that I can't solve with UPano, as it is not easy to explain I made a short video on this link : https://youtu.be/3XzHGLhwH7o

To resume : when a sphere is clicked, a PM script puts its name into a global variable, then it activates a panorama, gets the texture from a database and set the texture to the panorama. This works fine twice, then the texture displayed in the panorama doesn't change anymore although it is changed in the inspector.

If not clear, don't hesitate to ask.

Best regards,

Philippe

Re: Texture doesn't change the 3rd time ???

Hello.

Most likely, the problem is somewhere on your side, and most likely at some point you are creating a second panorama.
In your video (time 1:40), you can see that when you open the panorama, the slider in the hierarchy changes.
But, unfortunately, I have not seen your visual scripts, and I can’t say for sure what and where you are doing wrong.

Re: Texture doesn't change the 3rd time ???

Hello Alex

Thanks for your (as usual) quick answer for my issue about UPano.

To check if the problem was on my side, I built a new very light project from scratch with very simple actions, to see if I could reproduce the issue. So I confirm, I am afraid this is a UPano issue, as my "code" is pretty simple = get material texture / set Pano texture.

I made another vidéo to show the (same) issue in this new project: https://www.youtube.com/watch?v=_kwQyshva5M
I sent you a link to download the project on your email as it contains UPano and PlayMaker Assets.

Best regards.

4 (edited by grenouille 2020-04-09 14:49:00)

Re: Texture doesn't change the 3rd time ???

Hello,

I have a very similar problem.
I use the CubeFacesPanoRenderer and I change the renderer's textures at runtime using :

CubeFacesPanoRenderer.SetSide(int index, Texture2D texture)

But if I try to change it 3 times the textures won't change anymore.

I did a bit of research in the code and it seems the problem comes from the hasMesh field in PanoRenderer.
The field is reset to false in OnEnable() but is never set to true after that.
To hide and show the panorama I activate or deactivate the Panorama gameobject.

It's worth mentioning that if I try to use the CreateMesh() or UpdateMesh() function it causes an infinite loop.


EDIT :
If I comment line 265 in file PanoRenderer.cs the problem disappears :

protected void OnEnable()
{
    _pano = GetComponent<Pano>();
    hasMesh = false; // Line 265
}

But I'm not sure this is a correct solution.

Re: Texture doesn't change the 3rd time ???

Hello.

Philzmz sent me a project, and I already found and fixed this bug.
Yes, the problem is hasMesh.

How to fix it:
Move this line from OnEnable to OnDestroy.