You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Source/Scripts/FloorSetter.cs

50 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.Security.Policy;
using UnityEngine;
public class FloorSetter : MonoBehaviour
{
public List<Transform> transforms;
public GameObject prefab;
public GameObject CubePrefab;
public List<Vector3> positions;
1 month ago
//public void OnValidate()
//{
// Instantiator();
//}
[ContextMenu("PositionTaker")]
public void PositionTaker()
{
for (int i = 0; i < transforms.Count; i++)
{
positions.Add(transforms[i].localPosition);
}
}
[ContextMenu("Instantiator")]
public void Instantiator()
{
// for (int i = 0; i < positions.Count; i++)
// {
// Transform temp=Instantiate(CubePrefab,this.transform).transform;
// //Transform temp = Instantiate(new GameObject(), this.transform).transform;
// temp.localPosition = positions[i];
// //Instantiate(prefab, temp);
// }
for (int i = 0; i < positions.Count; i++)
{
//Transform temp=Instantiate(CubePrefab,this.transform).transform;
Transform temp = Instantiate(new GameObject(), this.transform).transform;
temp.name = "Floor Position";
temp.localPosition = positions[i];
Instantiate(prefab, temp);
}
}
}