powerfun-unity/Assets/Scenes/Ride/Scripts/PlayerItemFactory.cs
2021-03-30 17:29:40 +08:00

34 lines
840 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Assets.Scenes.Ride.Scripts
{
public class PlayerItemFactory : MonoBehaviour
{
public GameObject prefab; // This is our prefab object that will be exposed in the inspector
// Start is called before the first frame update
void Start()
{
Populate();
}
// Update is called once per frame
void Update()
{
}
void Populate()
{
GameObject newObj; // Create GameObject instance
for (int i = 0; i < 16; i++)
{
// Create new instances of our prefab until we've created as many as we specified
newObj = (GameObject)Instantiate(prefab, transform);
}
}
}
}