playMaker

Author Topic: create rendertexture store as pm variable?  (Read 2468 times)

wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
create rendertexture store as pm variable?
« on: June 02, 2021, 10:29:13 AM »
I'm attempting to take an in-game photo and retrieve it later to view in a scrapbook.

I've found the action Create RenderTexture and can assign it to a camera…. I can store the rendertexture as a playmaker variable in an fsm, but I'm not sure if this is actually the image or more like a reference to a temporary texture in memory… (or if there is any difference?)

Do I need to save the image (playerpref or easysave?) or can I just retrieve it later from this pm variable…? (assuming the gameobject/fsm remain active).

I'm unclear what PM is actually storing in its variable, and if I'm going to have issues carrying around a rendertexture I've created, when it isn't actively being used or displayed….
« Last Edit: June 02, 2021, 10:30:50 AM by wetcircuit »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: create rendertexture store as pm variable?
« Reply #1 on: June 02, 2021, 10:34:51 AM »
Hi.
There Texture is stored in memory.
When you stop the game it will be lost or when you change scene and have no reference to it anymore.

during gameplay you should be able to use it from the variable.

Best is to make a scene/project and play around with it, then if it works use it in your project.

AbeDieckman

  • Playmaker Newbie
  • *
  • Posts: 14
Re: create rendertexture store as pm variable?
« Reply #2 on: December 15, 2024, 10:39:06 PM »
@wetcircuit, did you ever figure this out? Having very similar trouble saving multiple in-game photos that can be viewed later. Would appreciate any thoughts!!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: create rendertexture store as pm variable?
« Reply #3 on: December 17, 2024, 02:35:40 AM »
Hi,

there is a custom action to take camera screenshots: TakeCameraScreenshot

have a camera setup to use your renderTexture, and then you can save it using the action above.

Save it in your persistentDataFolder, if you want your user to be able to access them later.

you'll find also custom actions to work with the persistentFolder. you'll likely want to be able to list available files, but of course it's best to know what you have there, and maybe save references in the playerprefs for the images path.

you can then load these images as sprites using the custom action "SetSprite", for this you need a fsmObject Variable of type Sprite.

Bye,

Jean