Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Is there a way to make a variable that is affected by all the objects that have the same script?

Discussion in 'Scripting' started by EliteWalrus, Oct 19, 2014.

  1. EliteWalrus

    EliteWalrus

    Joined:
    Aug 16, 2014
    Posts:
    44
    I want to make a script with a variable and attach this script to many objects. When one object changes the variable I want all the objects with the same script to receive the variable change.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    Sounds like you should use a static variable.

    --Eric
     
    EliteWalrus likes this.
  3. EliteWalrus

    EliteWalrus

    Joined:
    Aug 16, 2014
    Posts:
    44
    Thanks.