---
tags:
    - "Input, Player, Controls, Local, Multiplayer, Co-op"
---

# Player Input Camera

[Input](../index.md) / [Player Input](index.md) / **Player Input Camera**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :green_circle: Can Write

</div>

## Description

The Camera property of the Player Input component

## Code

```cs
// <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.InputSystem;

namespace VisualScript.Runtime
{
    [Get]
    [Set]

    [Title("Player Input Camera")]
    [Category("Input/Player Input/Camera")]
    [Description("The Camera property of the Player Input component")]

    [Image(typeof(IconBoltOutline), ColorTheme.Type.Blue)]
    [Keywords("Input, Player, Controls, Local, Multiplayer, Co-op")]

    [Serializable]
    public class GenTypeGameObject_PlayerInput_Camera : TypeGameObject
    {
        [SerializeField] private GetGameObject m_PlayerInput = new GetGameObject(
            new GenTypeGameObject_PlayerInput()
        );

        public override GameObject GetPreview(GameObject source)
        {
            GameObject instance = this.m_PlayerInput.GetPreview(source);
            if (instance == null) return default;

            PlayerInput component = instance.GetComponent<PlayerInput>();
            return component != null ? component.camera.gameObject : default;
        }

        public override GameObject Get(Args args)
        {
            PlayerInput instance = this.m_PlayerInput.Get<PlayerInput>(args);
            return instance != null
                ? instance.camera.gameObject
                : default;
        }

        public override U Get<U>(Args args)
        {
            if (typeof(U) == typeof(PlayerInput))
            {
                PlayerInput instance = this.m_PlayerInput.Get<PlayerInput>(args);
                return instance != null
                    ? instance.camera as U
                    : default;
            }

            return base.Get<U>(args);
        }

        public override void Set(GameObject value, Args args)
        {
            PlayerInput component = this.m_PlayerInput.Get<PlayerInput>(args);
            if (component != null) component.camera = (Camera) value.Get<UnityEngine.Camera>();
        }

        public override void Set<U>(U value, Args args)
        {
            if (typeof(U) == typeof(Camera))
            {
                PlayerInput component = this.m_PlayerInput.Get<PlayerInput>(args);
                if (component != null) component.camera = value as Camera;
            }

            base.Set<U>(value, args);
        }

        public override string ToString()
        {
            return $"{this.m_PlayerInput} Camera";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
```

