加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

cocos2d-x 粒子效果内存泄露及Unity一定范围内出怪实现备份。

发布时间:2020-12-14 17:19:39 所属栏目:百科 来源:网络整理
导读:std::string filename = "ExplodingRing.plist"; auto _emitter = ParticleSystemQuad::create(filename); if (_emitter) { _emitter-setPosition(Vec2(rand_x,rand_y)); addChild(_emitter,10); _emitter-setAutoRemoveOnFinish(true); } ==================
std::string filename = "ExplodingRing.plist";
auto _emitter = ParticleSystemQuad::create(filename);
if (_emitter)
{
_emitter->setPosition(Vec2(rand_x,rand_y));
addChild(_emitter,10);
_emitter->setAutoRemoveOnFinish(true);

}

===================包含图片的plist粒子效果文件会造成内存泄露。原因及修复XXXXX见如下地址。请允许我说一句粗口话,为这东西调了我超过2个星期时间才发现是引擎的问题,果然开源的东西 = 一堆人乱来?我可以确信的是,这个bug在最新的3.14版本没有得到修正。喜闻乐见

http://discuss.cocos2d-x.org/t/memory-leak-in-particle-system-v3-beta-2/11754/2

===================神坑cocos。。。。脱坑ing。


以下是unity一定范围内生成怪物的调试脚本。1秒一次 范围内随机。仅备份

using UnityEngine;
using System.Collections;

public class TestGenSc : MonoBehaviour {

	// Use this for initialization
	void Start () {
        InvokeRepeating("GenMonster",1,1);
	}
	
	// Update is called once per frame
	void Update () {
	
	}

    void GenMonster()
    {
        Vector2 v2 = Random.insideUnitCircle * 5.0f;
        Vector3 v3 = new Vector3(v2.x,v2.y);
        GameObject ob =  GameObject.CreatePrimitive(PrimitiveType.Cube);
        ob.transform.position = gameObject.transform.position;
        ob.transform.parent = gameObject.transform;
        ob.transform.localPosition = v3;
        ob.transform.localScale = new Vector3(0.5f,0.5f,0.5f);

    }

    void OnDrawGizmos()
    {
        Gizmos.color = new Color(0.0f,0.3f);
        Gizmos.DrawSphere(transform.position,5.0f);
    }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读