# GetOrCreate

> Creates a shared static data for the specified context (usable from both C# and HPC#)

## Definition

* **Type:** Method
* **Namespace:** [Unity.Burst](/engine/6000.7/script-reference/unity/burst.md)
* **Assembly:** UnityEngine.BurstModule

## GetOrCreate\<T>(uint)

Creates a shared static data for the specified context (usable from both C# and HPC#)

```csharp
public static SharedStatic<T> GetOrCreate<TContext>(uint alignment = 0)
```

### Parameters

**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): Optional alignment

### Returns

| Type                                                                             | Description                               |
| -------------------------------------------------------------------------------- | ----------------------------------------- |
| [SharedStatic\<T>](/engine/6000.7/script-reference/unity/burst/sharedstatic1.md) | A shared static for the specified context |

## GetOrCreate\<T, U>(uint)

Creates a shared static data for the specified context and sub-context (usable from both C# and HPC#)

```csharp
public static SharedStatic<T> GetOrCreate<TContext, TSubContext>(uint alignment = 0)
```

### Parameters

**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): Optional alignment

### Returns

| Type                                                                             | Description                               |
| -------------------------------------------------------------------------------- | ----------------------------------------- |
| [SharedStatic\<T>](/engine/6000.7/script-reference/unity/burst/sharedstatic1.md) | A shared static for the specified context |

## GetOrCreate(Type, uint)

Creates a shared static data for the specified context (reflection based, only usable from C#, but not from HPC#)

```csharp
public static SharedStatic<T> GetOrCreate(Type contextType, uint alignment = 0)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): A type class that uniquely identifies the this shared data**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): Optional alignment

### Returns

| Type                                                                             | Description                               |
| -------------------------------------------------------------------------------- | ----------------------------------------- |
| [SharedStatic\<T>](/engine/6000.7/script-reference/unity/burst/sharedstatic1.md) | A shared static for the specified context |

## GetOrCreate(Type, Type, uint)

Creates a shared static data for the specified context and sub-context (usable from both C# and HPC#)

```csharp
public static SharedStatic<T> GetOrCreate(Type contextType, Type subContextType, uint alignment = 0)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): A type class that uniquely identifies the this shared data**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): A type class that uniquely identifies this shared data within a sub-context of the primary context**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): Optional alignment

### Returns

| Type                                                                             | Description                               |
| -------------------------------------------------------------------------------- | ----------------------------------------- |
| [SharedStatic\<T>](/engine/6000.7/script-reference/unity/burst/sharedstatic1.md) | A shared static for the specified context |
