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); } ================
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, 0, 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.5f, 0.5f, 0.3f); Gizmos.DrawSphere(transform.position, 5.0f); } }