☑ Editor search asset by ID

I just had an idea. Could we have the editor’s search field allow searching by unique ID, instead of just by name? It would be super helpful when:

  • I’m using app.assets.get(50489); It would be useful if I could use that same ID to find it in the editor.
  • Looking for one unique asset if I’m using several assets named texture.jpg and the console says there was a problem with texture.jpg?id=50489

2 Likes

Nice suggestion. I have copied this request into our feature request database. It will probably take us a wee while to get around to this, so no promises on ETA - but it’s a completely valid suggestion. :smile: Thanks!

Hi, will. I have another suggestion. Sometimes, we might use this.app.assets.get(123456); to get the asset. Something like this :

Under the circumstances, if another developer wants to fork my project, the IDs of the assets will change while the IDs in script will not change. This can result in assets not found error.

You shouldn’t really be using asset ids in your scripts. You should use script attributes of type asset or use some other attribute that doesn’t change like asset tags.

Haw-haw :grinning: , thank you for you advice. I will try it next time.

@marquizzo to second what Vaios said in another post. You shouldn’t really hardcode asset ids in your scripts. In fact I wouldn’t recommend using asset ids at all. There are several other ways to get assets:

  1. Use asset script attributes to reference specific assets
  2. Use this.app.assets.findByTag(tag) to find a set of assets with a tag
  3. Use this.app.assets.find(name, type) to find an asset by it’s name

Using asset ids will break if you ever fork the project.

That’s a good point. I hadn’t thought about issues with project forking.

Now it is possible to search by ID, simply typing it in.

2 Likes

ok, so this is an old thread - still I am reactivating topic, as I am not able to search by ID in the editor now