Usage of external variables

I am working on a custom extension, and I need to use some external variables (the extension’s variables).
There is a way to check them, and a way to change them, but I don’t know if is possible to use them (for example in a function). I would need that. There is a way to use them? Maybe by javascript?

Thank you

There are so many variables. Which ones are you talking about?

These variables and properties can be used just like a regular variable. Once setup, they’re in the autocomplete.

You can also pass values through parameters or create expressions.

I was talking about external scene variables:
if I create an external variables, and I set it as “10”, and I call that by name as a scene variables, the program read that as a new scene variables with value of 0.

We might need to see your events.

This

In a behavior like this works for me.

Make sure the variables are spelled exactly the same and the function is being called or the behavior is assigned to an object that is in the scene.

Also me work for scene variables, but not in the functions.
That’s an example of my problem:



Schermata del 2024-11-13 09-04-17

It is on an object of the extension.
If I check the variables as a normal scene variables in the condition event, it read that as 10, but if a want to use in a function (for example in the debug), it read that as 0.

I mean, if I treat as a normal variable the condition work, but not the functions
Schermata del 2024-11-13 09-14-52

You’re setting up a variable as an extension variable are you also setting it as a scene variable. The names can be confusing.

Sorry, can you explain it better?
how can I use in a function an extension variable?

Function variables are setup on the top

And use the action that looks like a scene variable

Scene and global variables use the

They get setup in the scene with the scene setup.

It’s preferable to use properties to return values.
You add them under the behavior property screen that open when you click the behavior’s name.

You can click the 3 dots next to the property to add actions and expressions to read them and set them.

You can look at the events of user created behaviors to get a better understanding if you need to. The actual documentation is limited.

It’s tough for me to explain. There are probably better resouces.

https://m.youtube.com/@GDevelopApp

https://m.youtube.com/@VictrisGames

If you setup behavior properties then you can get the values from expressions or properties instead of having to setup a scene variable.

ok, but I would need an array for the entire extension, It should be used by static custom function

OK. You can use external variables or create a function that returns the values to a parameter setup as variable. That way the behavior can be used with any variable without changing the behavior.

You can setup a parameter as type variable and then use an action to either copy the variable in the paramer to a function variable or copy a function variable to the variable in the parameter.