# GetInteger

> Get a named integer value. If the integer property is not found an exception is thrown.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## GetInteger(string)

Get a named integer value. If the integer property is not found an exception is thrown.

```csharp
public int GetInteger(string name)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.

### Returns

| Type                                                       | Description                                                                   |
| ---------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The integer property value. Returns `0` if the integer property is not found. |

### Remarks

Additional Resources: [Material.SetInteger](/engine/6000.7/script-reference/unityengine/material/setinteger.md), [Materials](/engine/6000.7/manual/materials-and-shaders/materials.md), [ShaderLab documentation](/engine/6000.7/script-reference/unityengine/shaders.md), [Shader.PropertyToID](/engine/6000.7/script-reference/unityengine/shader/propertytoid.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        Renderer rend = GetComponent<Renderer> ();
        rend.material.shader = Shader.Find("MyFlipBook");
        print(rend.material.GetInteger("_NumFrames"));
    }
}
```

## GetInteger(int)

Get a named integer value. If the integer property is not found an exception is thrown.

```csharp
public int GetInteger(int nameID)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The name ID of the property retrieved by [Shader.PropertyToID](/engine/6000.7/script-reference/unityengine/shader/propertytoid.md).

### Returns

| Type                                                       | Description                                                                   |
| ---------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The integer property value. Returns `0` if the integer property is not found. |

### Remarks

Additional Resources: [Material.SetInteger](/engine/6000.7/script-reference/unityengine/material/setinteger.md), [Materials](/engine/6000.7/manual/materials-and-shaders/materials.md), [ShaderLab documentation](/engine/6000.7/script-reference/unityengine/shaders.md), [Shader.PropertyToID](/engine/6000.7/script-reference/unityengine/shader/propertytoid.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        Renderer rend = GetComponent<Renderer> ();
        rend.material.shader = Shader.Find("MyFlipBook");
        print(rend.material.GetInteger("_NumFrames"));
    }
}
```
