UUID tutorial

UUID Tutorial


var UUID = Universally Unique IDentifier
Every Wick object has their special uuid code.

So does every clone, which makes it really helpful when sorting out every specific clone from another!

To refer to an object’s uuid code, you can simply use this code:

this.uuid; // UUID CODE

You can then use this code to refer to a specific object like this:

var objA = Wick.ObjectCache.getObjectByUUID("LONG UUID CODE");

You won’t really have to memorize the uuid code for every object, what you can do is have an array of them to organize your objects in a system.

For example, you can create an object with a default script like this:

if(this.isClone)
project.CLONEs.push(this.uuid); // Add to array of clones
else
project.OBJECTs.push(this.uuid); // Add to array of objects

And you can remove a specific or a random clone like this:

Wick.ObjectCache.getObjectByUUID(project.CLONEs[random.integer(0,project.CLONEs.length)]).remove();

And so on.

uuid code is just one way to organize your clones.

If a programmer was reading this, they’re probably thinking:
“Can’t I just give every clone a variable and refer to em’ that way?”

And if I was to respond to them, I would say:
“Yes, you can.”

Then why did I write this tutorial?
Because this code might be helpful with something in the future, or might help someone else with something, who knows ._.


But hey, even assets have a uuid code when they’re in the asset library.

Here’s how to find the code for an asset:

text.setText("UUID code for "+this.project.assets[0].filename+":\n"+
this.project.assets[0].uuid); 
// Replace text with name of text

Though idk how that would be useful since I can’t figure out how to spawn a file from the library with code ._.

Yet, the uuid thing is still useful since clones don’t have names.
You can easily use that code to name the clones like this:

Wick.ObjectCache.getObjectByUUID("UUID_Code").identifier="Name";

Idk how that is supposed to help either, or if this code is useful at all since there are millions of workarounds, yet this is simply a tutorial that I made to waste ur time.

Hope u enjoyed :+1:

Here’s a wick file in relation to this tutorial:
My Project1-30-2021_12-11-00.wick (5.9 KB)

3 Likes

good to know hamzah
i’m making a test where I want to identify my clips and this could be a solution.
remember we also have the object.clones that is already an array of clones !

1 Like

Also a while back I found a way to generate uuids in Wick Editor, using this function:

uuidv4()
1 Like