加载人物模型


        var abPath = "prefab/character/nanjianshi_01all.unity3d";
        var assetName = "Nanjianshi_01All";

LuaHelper.GetResManager().LoadPrefabAsync(abPath, assetName, CreateModel);



        public bool LoadPrefabAsync(string abPath, string assetName, LoadPrefabAsyncCallBack lpac=null)
        {
            //lpac = lpacallFunc;
//            lpacb = lpacallFunc;

#if UNITY_EDITOR
            string abname = abPath;
            LoadPrefabSync(abPath, assetName, 1, null, false);
            if (lpac != null) {            
                lpac(abname);
                return true;
            }
#endif
            if (!prefabs.ContainsKey(abPath))
            {
                LoadBundleAsync(abPath, assetName, false, lpac);
            }
            else if (lpac != null)
            {
                lpac(abPath);
            }
            return false;
        }


        public bool LoadPrefabSync(string abPath, string assetName, int poolSize, Transform parent, bool dontDestroy = false)
        {
            string abName = abPath;
            string[] nameArray = abPath.Split('/');
            if (nameArray.Length == 0)
            {
                return false;
            }
            if (!prefabs.ContainsKey(abName))
            {
                GameObject obj = LoadAsset<GameObject>(abName, assetName, dontDestroy);
                prefabs.Add(abName, obj);
                OldGameObjectPool pool = new OldGameObjectPool();
                bool trueInact = true;
                if (abPath.StartsWith("prefab")) trueInact = false;
                if (abPath == "ui/prefab/map/luxiandian") trueInact = false;
                pool.Initialize(obj, parent, poolSize, trueInact);
                pools[obj] = pool;

                //if (LuaHelper.GetResManager().CanDestroy(abPath))
                //    LuaHelper.GetResManager().UnLoadAssetBundle(abPath, false);
            }
            return true;
        }


    void CreateModel(string str)
    {
       var go = LuaHelper.GetResManager().CreateGoInstance(str);
        go.transform.SetParent(RolePoint.transform);
        go.transform.localScale = Vector3.one * 16;
        go.transform.localEulerAngles = Vector3.zero;
        go.transform.localPosition = Vector3.zero;        

        LUA_SetLayerIncludeChildren(go, "UI");
        LUA_AnimationPlay(go, "Idle01");                  // Idle01

    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值