How to make a script interact independently with each object it is added to?

PatrickJ Posts: 4
edited June 2022 in Programming #1

I have a script attached to several objects in my scene.

This script is designed to make an object shrink if you tap and hold on it. If you release your tap too soon, the object goes back to its initial size.

However, when I tap and hold on one of my objects, all the objects with the script attached shrink too, instead of behaving independently from one another.

Best Answer

  • PatrickJ
    PatrickJ Posts: 4
    edited June 2022 #2 Answer ✓

    Nevermind, I found the solution : some of my variables at the beginning of the script didn't have the "var" mention in their declaration, so they were common to all of my objects with the script equipped.