# Proper method of loading custom particle systems from Json?

**URL:** <https://forum.babylonjs.com/t/proper-method-of-loading-custom-particle-systems-from-json/8713>\
**Category:** Questions\
**Tags:** editor\
**Created:** [February 21, 2020, 5:33am UTC](https://forum.babylonjs.com/t/proper-method-of-loading-custom-particle-systems-from-json/8713 "2020-02-21T05:33:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/stephen/32/7585_2.png) [@Stephen](https://forum.babylonjs.com/u/Stephen)\
**Post date:** [February 21, 2020, 5:33am UTC](https://forum.babylonjs.com/t/proper-method-of-loading-custom-particle-systems-from-json/8713/1 "2020-02-21T05:33:23Z")

</div>

Hey Gang,

I made some particle effects in the babylon editor since this makes it a lot easier than typing it out in code. I then exported the json, but when trying to use the particle systems in my project there are multiple issues.  
I eventually got it to work, but it feels like a really hacky way of doing it, so I’d like some feedback/advice on how to do it better 🙂

**1. When I export to json from the babylon editor the particle texture name won’t be the actual file name, but a really long string. (Not ‘skull.png’, but ‘data:image/png;base64,iVBORw0KGgoAAAANSUhE…’)**

**2. It will always try to pull the particle texture from a path on the babylon website even when the path for the json is set correctly ([assets.babylonjs.com/particles/textures/xxxxx](http://assets.babylonjs.com/particles/textures/xxxxx))**

I found a thread talking about this issue [Forum Post](https://forum.babylonjs.com/t/particlehelper-loadasync-loads-textures-from-https-assets-babylonjs-com-particles-textures/3162) however the solution doesn’t work for me. `BABYLON.Constants.PARTICLES_BaseAssetsUrl` doesn’t even exist for me.

I worked around this by `set.systems[0].particleTexture.updateURL("skull.png");` after the particle system has loaded in. However this way we still get a failed request to where it originally wants to find it.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 21, 2020, 4:19pm UTC](https://forum.babylonjs.com/t/proper-method-of-loading-custom-particle-systems-from-json/8713/2 "2020-02-21T16:19:22Z")

</div>

Let me ping @julien-moreau

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/stephen/32/7585_2.png) [@Stephen](https://forum.babylonjs.com/u/Stephen)\
**Post date:** [March 16, 2020, 2:21am UTC](https://forum.babylonjs.com/t/proper-method-of-loading-custom-particle-systems-from-json/8713/3 "2020-03-16T02:21:40Z")

</div>

Hey @Deltakosh  
Thanks for the reply.  
I’ve been playing around with this a bit more since I made this forum post, but I still can’t figure it out.

I guess you’re pinging julien since the editor is involved.  
In my case the editor spitting out a really long string isn’t that huge of an issue since I can just manually delete and change it. So that only adds one extra step.

The bigger issue is that I cannot change the path where it wants to find the texture for the effect before it makes a request to the babylon server.  
If I use `set.systems[0].particleTexture.updateURL("skull.png");` it will load the correct image, but it will still do a failed request to the original path first which will lead the users to have an error message in the console and makes one unnecessary get request.

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/5/510e4649910d8779a8fae4fcff4725cc30cd9453.png)  
Do you have an idea why `BABYLON.Constants.PARTICLES_BaseAssetsUrl` doesn’t seem to exist for me? Was this changed over the last couple of updates?

**Edit:**  
I just realized the long string in the particle json came from me clicking **embed texture** when exporting from the editor. So issue 1 is fixed by just selecting **no** when asked.  
When trying to use an embedded texture the same issue happens though with it making a get request to some babylon server.

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/4/4d2722ed5612d907962cb9e780d0a2909c3e59a2.png)

Greetings,  
Stephen

---

<div class="post-metadata">

**Author:** ![julien-moreau](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/julien-moreau/32/12070_2.png) [@julien-moreau](https://forum.babylonjs.com/u/julien-moreau)\
**Post date:** [March 16, 2020, 11:12pm UTC](https://forum.babylonjs.com/t/proper-method-of-loading-custom-particle-systems-from-json/8713/4 "2020-03-16T23:12:07Z")

</div>

WoW !! I have missed this post !!  
so sorry !!

I have to check the code before giving you an answer but I’ll have a look ASAP

I understand urls can be a problem and I hope to find a solution!

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/stephen/32/7585_2.png) [@Stephen](https://forum.babylonjs.com/u/Stephen)\
**Post date:** [March 20, 2020, 1:16am UTC](https://forum.babylonjs.com/t/proper-method-of-loading-custom-particle-systems-from-json/8713/5 "2020-03-20T01:16:31Z")

</div>

I found a solution!

1. Was just me pressing ‘ **embed texture** ’ without realizing it when exporting from the editor. When selecting **NO** the string is just the file name.
2. Managed to change the path by changing the url for `BABYLON.ParticleSystemSet.BaseAssetsUrl`. The texture now loads offline from the project files.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/6/6b6471f1851cf1b12c97d8c46318e7dd1696c862.png)

This thread also goes into more detail about that.

> [@ParticleHelper.LoadASync loads textures from https://assets.babylonjs.com/particles/textures](https://forum.babylonjs.com/t/particlehelper-loadasync-loads-textures-from-https-assets-babylonjs-com-particles-textures/3162):
>
> I have a custom .json file saved locally that defines my particle system. When I set ParticleHelper.BaseAssetsUrl to my local public folder the json loads fine but then the texture that is defined as “textureName”: “flare.png” in json file is trying to load from https://assets.babylonjs.com/particles/textures even tho BaseAssetsUrl is set to my local directory. To the level I was able to understand the source code, static variable BaseAssetsUrl is only used in ParticleHelper class and when th…
