Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InstantiateCube : MonoBehaviour
{
public GameObject CanvasGameScene;
public int MaxCube;
public float[] x, y;
public List<GameObject> objectsOnScene = new List<GameObject>();
public List<GameObject> TilePrefabs;
void Start()
{
for (int i = 0; i < MaxCube; i++)
{
GameObject Clone;
Clone = Instantiate(TilePrefabs[i], new Vector3(x[i], y[i], i), Quaternion.identity) as GameObject;
Clone.transform.SetParent(CanvasGameScene.transform, false);
objectsOnScene.Add(Clone);
}
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InstantiateCube : MonoBehaviour
{
public GameObject CanvasGameScene;
public int MaxCube;
public float[] x, y;
public List<GameObject> objectsOnScene = new List<GameObject>();
public List<GameObject> TilePrefabs;
void Start()
{
for (int i = 0; i < MaxCube; i++)
{
GameObject Clone;
Clone = Instantiate(TilePrefabs[i], new Vector3(x[i], y[i], i), Quaternion.identity) as GameObject;
Clone.transform.SetParent(CanvasGameScene.transform, false);
objectsOnScene.Add(Clone);
}
}
}
скрипт для удаления не знаю как написать, много пробовал