Camera Target Texture#
Rendering / Camera / Camera Target Texture
Can Read
Can Write
Description#
The Target Texture property of the Camera component
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.Rendering;
namespace VisualScript.Runtime
{
[Get]
[Set]
[Title("Camera Target Texture")]
[Category("Rendering/Camera/Target Texture")]
[Description("The Target Texture property of the Camera component")]
[Image(typeof(IconCamera), ColorTheme.Type.Blue)]
[Serializable]
public class GenTypeTexture_Camera_TargetTexture : TypeTexture
{
[SerializeField] private GetGameObject m_Camera = new GetGameObject(
new GenTypeGameObject_Camera()
);
public override Texture GetPreview(GameObject source)
{
GameObject instance = this.m_Camera.GetPreview(source);
if (instance == null) return default;
Camera component = instance.GetComponent<Camera>();
return component != null ? component.targetTexture : default;
}
public override Texture Get(Args args)
{
Camera instance = this.m_Camera.Get<Camera>(args);
return instance != null
? instance.targetTexture
: default;
}
public override void Set(Texture value, Args args)
{
Camera component = this.m_Camera.Get<Camera>(args);
if (component != null) component.targetTexture = (RenderTexture) value;
}
public override string ToString()
{
return $"{this.m_Camera} Target Texture";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}