playMaker

Author Topic: Create a render texture from the camera at runtime  (Read 903 times)

Lokefot

  • Playmaker Newbie
  • *
  • Posts: 12
Create a render texture from the camera at runtime
« on: October 09, 2020, 03:07:13 PM »
Hey all! :D
I am having  some troubles getting a render texture from the camera to an ingame screen at runtime.
What I hope to achieve is:
Having the players create several cameras
Having the players create several monitors
Have create a  material that is bound to one spesific camera's render texture so cameras are cycleable on the screens by switching materials.

What  im unable to do is getting the render  texture from  the camera and storing  it  into a  material at runtime.

Or is this a bad way to achieve this?
Thanks in advance!  :)

Edit, i  have found the "Set Camera Target Texture" on the ecosystem, which i belive  is  what i need, but i get some errors when downloading. Does  anyone know how to solve:
Assets\PlayMaker Custom Actions\Camera\SetCameraTargetTexture.cs(41,14): error CS0619: 'GameObject.camera' is obsolete: 'Property camera has been deprecated. Use GetComponent<Camera>() instead. (UnityUpgradable)'

and

Assets\PlayMaker Custom Actions\Camera\SetCameraTargetTexture.cs(41,14): error CS0266: Cannot implicitly convert type 'UnityEngine.Component' to 'UnityEngine.Camera'. An explicit conversion exists (are you missing a cast?)

« Last Edit: October 09, 2020, 03:33:09 PM by Lokefot »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Create a render texture from the camera at runtime
« Reply #1 on: October 21, 2020, 02:08:41 PM »
Hi.

Maybe this tutorial can help.

its for a minimap but it works similar :