Is there any way to reference a value of another script in the inspector

Hi!
Basically I’m trying to put everything in one place. For example, I have an enemy
8890911--1215747--1_1.jpg
Each of the damageboxes has it’s own script
8890911--1215750--1_2.jpg
Instead of clicking every damagebox and setting up the damage, I’d like the Enemy script to have all the values as reference in the inspector, something like that:
8890911--1215753--1_3.jpg

Is there any way to achieve that? Thank you in advance!

Definitely possible to achieve by coding your own custom inspectors. There’s a lot of resources out there on how to do that.

Alternatively, you could just use a collection of a plain C# class, which has a serialised field for a game object (or any other relevant component) and this damage value.

I found an example to achieve this and it works almost perfectly, but…the problem now is that for some reason it doesn’t update the changes unless I Open the prefab I’m trying to change. Once it’s open, it works as intended - changing the value in the parent object does so in the child and vice versa. But when I go back to the scene and select the prefab in the assets folder and try to change the damage values - it does not update it. How can I fix this?
Here’s the code I used for the custom editor:

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(EnemyProjectile), true)]
public class CIEnemyProjectileDamage : Editor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        EnemyProjectile enemyProjectile = target as EnemyProjectile;
        EnemyDamageBox damageBox = enemyProjectile.GetComponentInChildren<EnemyDamageBox>();

        EditorGUILayout.Separator();
        GUILayout.Label("[DamageBox]");
        if (damageBox != null)
        {
            SerializedObject damageBoxSO = new SerializedObject(damageBox);
            if (damageBoxSO != null)
            {
                SerializedProperty prop = damageBoxSO.GetIterator();
                while (prop.NextVisible(true))
                {
                    if (prop.name != "m_Script") EditorGUILayout.PropertyField(prop);
                }
                prop.Reset();
                damageBoxSO.ApplyModifiedProperties();
            }
        }
    }
}

I managed to find a solution that seems to work, although I don’t really understand what it does in this particular case
Basically, before I call this: damageBoxSO.ApplyModifiedProperties();
I added this line:

if (damageBoxSO.hasModifiedProperties) EditorUtility.SetDirty(enemyProjectile);

(if you don’t check for hasModifiedProperties the inspector will stuck in infinite loop of what it looks like updating the prefabs values)
Now editing damage values are saved even without opening the prefab. Not sure if it’s the right way to do that, but it works. The only problem here is that you can’t use Undo to revert changes you made because they are not recorded, but I don’t really mind that.