Changes to the script variable from the outside

Hello. There is a non-trivial task. We in the team use the numbering of versions of the form: year, month, day, hour, minute. This information is stored in the game, and is called as a cheat code. I would like to automate the process. Version information is stored in a variable, in a script, and is written manually. Is it possible to change the value of a variable at the time of project assembly, taking the value from the system.

Hi @sergey_ch,

If you are talking about PlayCanvas scripts then you can directly access a property from another script like this, by finding first the entity that holds it:

const entityThatHoldsScript ='Entity Name');

// --- we then find the instance of the script using the script type name
const scriptInstance = entityThatHoldsScript.script.scriptTypeName;

// --- you can now access all properties and methods
// --- e.g. a property like this.myProperty
scriptInstance.myProperty = 10;

not quite. I’m looking for an opportunity to find a hook to subscribe to, and run the function, at the time of building the project for download

I see, how are you building the project? Are you using the Rest API?

If that’s the case you can use the get job endpoint to query the status of the build.

1 Like