Editing prefab using an editor

Have a look at PrefabUtility.ApplyPrefabInstance and see if that helps. Also, check out the post in this forum on using code tags. Makes your code easier to read:

public Tower_Class prefab;

public Sprite TowerIcone
{
    get
    {
        if (prefab != null)
        {
            return prefab.Icone;
        }
        else
            return null;
    }

    set
    {
        if (prefab != null)
        {
            prefab.Icone = TowerIcone;

            EditorUtility.SetDirty(prefab);
        }
    }
}
1 Like