I need to get one of the character values in another script, but I can’t find how to make sure that not all player values are transferred to another script
1 Like
You can pass only the specific character value by using a getter method or a structured data transfer. Instead of sharing the entire player object, create a function in the target script that accepts only the needed value, like:
// In the source script
public int GetHealth() {
return health;
}
// In the target script
int characterHealth = sourceScript.GetHealth();
This ensures only the necessary data is transferred.
1 Like