how to pass a variable from one script to another

Hy guys i have read on the documentation but i can’t understand how to pass a variable from one script to another : i have the maincamera(GameObject) and attached to it i have a script “SparaBlocco” in this script i have a integer “vita” that contain the life of an object. i wont to access at this variable in another script: “AI” how can i do?? sorry for the englisch…

This question has a lot of answer on this forum already:

Hi, before questions here, try searching it up a bit. It will save your and and our time :slight_smile:
Here’s how you can do it: