Overcoming autorelease and getting RenderTexture texture easily

Hi!
I want to have a bunch of sprites for drawing to a RenderTexture every now and then. Is there a way to get it OFF the autorelease pool, or even better, to have it never be put on there when calling create? I don’t appreciate my member objects being deleted before I get to use them :slight_smile: For these sprites it makes no sense to add them as a child anywhere and I don’t want to put the extra code into update to increment the ref counter. Am I missing something here?

Another question I have is why isn’t there a public function getTexture in RenderTexture? It seems like an unnecessary hassle to have to go through the associated sprite ( ->getSprite()->getTexture() ) every time when the texture is the same pointer…

I use Cocos2d-x 3.6. Thanks for any answers!

What you can do is to do a CC_SAFE_RETAIN on the sprites, then CC_SAFE_RELEASE once you are done with them.

That is functionally equivalent to retain. Do I understand correctly that I would have to call retain for every frame?

You just need to call it after you created your sprites. There is no need to call it every frame.