question

David Coombes avatar image
David Coombes asked

PlayFab breaking runtime rendertexture in Unity; unassigns texture assignment in material

Bug : In Unity, PlayFab is doing something in the background that is causing a texture assignment to be lost after about a second.

I have a Start scene and a Star Map scene. The Star Map scene creates a rendertexture and assigns it to a material at runtime, which is drawn onto a quad for an overlay of scanner range.

Start(){
        scanRT = new RenderTexture(Screen.width, Screen.height, 0, RenderTextureFormat.ARGB32);
        scanRT.name = "scannerTexture";
        scanCam.targetTexture = scanRT;
        matScan.mainTexture = scanRT;
}

After installing PlayFab, the material loses assignment of the rendertexture after about one second.

If I launch the Star Map scene directly, the texture is lost after about one second. If I launch the Start scene and delay loading of the Star Map scene by 1.2 seconds, the RT remains assigned and it all works correctly. I have just removed PlayFab completely and the Star Map scene works correctly.


unity3d
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Coombes avatar image David Coombes commented ·

Unable to edit : It's the PlayFab editor extensions.

1) Uninstall PlayFab, no bug.
2) Install PlayFab Unity Editor Extensions, no bug.
3) Log into PlayFab through PlayFab EdEx window; bug happens.

0 Likes 0 ·
David Coombes avatar image David Coombes commented ·

It's the PlayFab window that does it. Close the extensions window and the bug doesn't happen.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ David Coombes commented ·

May I ask what's your unity version and extension version?

Do you install any other 3rd party plugins?

Can you also briefly describe what each scene does so that we can narrow down the scope?

0 Likes 0 ·
David Coombes avatar image David Coombes Seth Du ♦ commented ·

I'm using Unity 2019.1.12f1 and extensions 2.78.191121

I've created a test scene that reproduces the bug from a new Unity project. It's consistent behaviour.

playfabbugtest.zip

Open the attached project and it'll render some spheres into a render texture and show them on the quad.

Import PlayFabEditorExtensions asset and with the PlayFab EdEx window open run and it'll still show the spheres on the quad.

Log into PlayFab (with the window open) and run and after a second the quad image is replaced with all white.

Close the PlayFab EdEx window and run and the spheres are drawn correctly.

The loss of the rendertexture coincides with a change in the PlayFab window on the progress bar. There's a flash of green progress in the PlayFab EdEx panel and then the rendertexture is lost. Appears to be part of the log in/validation process drawing an update to the window.

0 Likes 0 ·
playfabbugtest.zip (11.2 KiB)
Show more comments

1 Answer

·
Seth Du avatar image
Seth Du answered

According to the team, this is by design and this will only happen in the Editor. The cause is the call to AssetDatabase.Save(), and if you manually call it, the render will be lost in the editor as well, which mean a texture re-draw action will be required to prevent this.

Moreover, PlayFab Extension cannot turn off AssetDatabase.Save() or else all customers will lose their local PlayFab settings.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.