简单的做法:
把NGUI导入Unity里,NGUI->Open->Prefab Toolbar选择想要的滑动条拖进场景中如图:
给Control - Colored Slider添加脚本:
using UnityEngine;
using System.Collections;using System.Collections.Generic;
public class loadSlider : MonoBehaviour
{
private UISlider USlider;
private float m_time = 0;
private void Awake()
{
USlider = GetComponent<UISlider>();
}
void Start()
{
USlider.value = 0;
}
void Update()
{
if (m_time < 1)
{
m_time += Time.deltaTime;
USlider.value += 1 / 120.0f;
m_time = 0;
}
if (USlider.value == 1)
Application.LoadLevel(01);//加载到01场景
}
}