Search Unity

Reset specific variables to scripts default in C#

Discussion in 'Scripting' started by Maffew, Sep 5, 2014.

  1. Maffew

    Maffew

    Joined:
    Jan 22, 2014
    Posts:
    14
    Hi,

    I've got a script that's on several objects, contained in several prefabs with specific settings set on each.
    I have just added an AudioClip to the script and want to be able to change the clip on all scripts by dragging a new clip to the script in the Project Window. I have added my clip to the script in the project window but the scripts that already exist in scene are showing 'None' in the audio clip field. Is there a way to propagate this property to all instances of the script or simply Reset the property on start? I don't want to Reset the entire script object because several other variables have been set on each instance of the script.

    Thanks

    Matt
     
  2. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    If you use a default inspector you can search for your script name in the scene, select all found objects and just multi-edit your clip in there.