Question by
peterrushton52 · Mar 20 at 02:16 PM ·
c#camerarendertexture
"Camera does not contain a definition for targetTexture"
So I am working on a portal system from Brackey's guide (https://youtu.be/cuQao3hEKfs?t=786) and am trying to use the camera api as follows:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PortalTextureSetup : MonoBehaviour
{
public Camera blueCamera;
public Camera OrangeCamera;
public Material blueMaterial;
public Material OrangeMaterial;
void Start()
{
// Debug.Log(blueCamera);
if(blueCamera.targetTexture != null) {
blueCamera.targetTexture.Release();
}
blueCamera.targetTexture = new RenderTexture(Screen.width, Screen.height, 24);
}
}
This, however, gives me the error
Assets\PortalScripts\PortalTextureSetup.cs(17,23): error CS1061: 'Camera' does not contain a definition for 'targetTexture' and no accessible extension method 'targetTexture' accepting a first argument of type 'Camera' could be found (are you missing a using directive or an assembly reference?)
I have absolutely no clue why this is appearing, and I cant find other people with a similar issue. It might be noteworthy that I cannot drag a camera object into the camera variable while in the editor. I have tried updating and reinstalling unity to no luck. Any ideas?
Comment
Your answer
Follow this Question
Related Questions
Render to minimap on command 1 Answer
Camera depth causing RenderTexture issue 0 Answers
my camera is rotating on Z axis when i just set it on X and Y 0 Answers
CEFGlue with Unity 1 Answer
Problem with camera Rendering 2 Answers