How do you programmatically retrieve the rendering camera from its render texture?

Programmatically if you have access to a render texture, how would you get access to the camera which rendered it?

Render Textures do not include references to cameras, because that may not be the purpose for a given render texture. Instead a camera will include a reference to Camera.targetTexture, but not vice-versa. You would have to include your own support scripts for the render texture to inform your code which render texture is assigned to which camera.

it is possible to know which camera is rendering your object (Bare in mind that more than one camera at the same time can be rendering your object).

Checkout this:

var anObject : GameObject;
private var cam : Camera;
private var planes : Plane[];

function Start() {
    cam = Camera.main;
    planes = GeometryUtility.CalculateFrustumPlanes(cam);
}

function Update() {
    if(GeometryUtility.TestPlanesAABB(planes,anObject.collider.bounds))
        Debug.Log(anObject.name + " has been detected!");
    else
        Debug.Log("Nothing has been detected");
}

That code detects if an object is being "seen" by a camera. Hope it helps you out ;)

C# Version here as well:

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
    public GameObject anObject;
    private Camera cam;
    private Plane[] planes;
    void Start() {
        cam = Camera.main;
        planes = GeometryUtility.CalculateFrustumPlanes(cam);
    }
    void Update() {
        if (GeometryUtility.TestPlanesAABB(planes, anObject.collider.bounds))
            Debug.Log(anObject.name + " has been detected!");
        else
            Debug.Log("Nothing has been detected");
    }
}