35 lines
826 B
C#
35 lines
826 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class OtherUserMannger : MonoBehaviour
|
|
{
|
|
public int count;
|
|
public GameObject otherUser;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if(transform.childCount > count)
|
|
{
|
|
for(int i = transform.childCount - 1; i >= count; i--)
|
|
{
|
|
Destroy(transform.GetChild(i).gameObject);
|
|
}
|
|
}
|
|
else if(transform.childCount < count)
|
|
{
|
|
for(int i = transform.childCount; i < count; i++)
|
|
{
|
|
GameObject user = Instantiate(otherUser);
|
|
user.transform.parent = transform;
|
|
}
|
|
}
|
|
}
|
|
}
|