Table of Contents

Method Clone

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

Clone<T>(T)

Clones a MonoBehaviour using UnityEngine.Object.Instantiate<T>(T).

public static T Clone<T>(this T obj) where T : MonoBehaviour

Parameters

obj T

The object to clone.

Returns

T

A new instance of the object.

Type Parameters

T

The MonoBehaviour type to clone.

Clone<T>(T, int)

Clones a MonoBehaviour a given number of times.

public static List<T> Clone<T>(this T obj, int count) where T : MonoBehaviour

Parameters

obj T

The object to clone.

count int

The number of clones to create.

Returns

List<T>

A list of cloned instances.

Type Parameters

T

The MonoBehaviour type to clone.