예제 #1
0
    //加载车
    public static GameObject LoadCar(string PrefabName)
    {
        int        hash = PrefabName.GetHashCode();
        GameObject obj  = null;

        if (!CarCache.TryGetValue(hash, out obj))
        {
            obj            = Resources.Load <GameObject>(cfg_CarPath + PrefabName);
            CarCache[hash] = obj;
        }
        if (obj == null)
        {
            Debugger.LogError("车不存在:" + PrefabName);
            return(null);
        }
        return(GameObject.Instantiate(obj));
    }