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

# Player Input Player Index

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

## Description

Compares the Player Index property of Player Input component to another value

## Parameters

| Name | Description |
| :--- | :---------- |
| Player Input |  |
| Compare |  |
| Value |  |

## 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
{
    [Title("Player Input Player Index")]
    [Category("Input/Player Input/Player Index")]
    [Description("Compares the Player Index property of Player Input component to another value")]

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

    [Parameter("Player Input")]
    [Parameter("Compare")]
    [Parameter("Value")]

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

        [SerializeField] private CompareNumber m_Compare = new CompareNumber();

        [SerializeField] private GetInteger m_Value = new GetInteger();

        protected override string GetTitle(GameObject source)
        {
            string member = TextUtils.ThemeAsKeyword("Player Index");
            return $"{this.m_PlayerInput} {member} {this.m_Compare} {this.m_Value}";
        }

        protected override bool Run(Args args)
        {
            PlayerInput component = this.m_PlayerInput.Get<PlayerInput>(args);
            if (component == null) return false;

            return this.m_Compare.Compare(component.playerIndex, (int) this.m_Value.Get(args));
        }
    }
}
```

