fix: ReadOnlyPropertyDrawer + BoardManager skips PlacePieces in campaign mode

I1: ReadOnlyDrawer shows [ReadOnly] fields as greyed out in Inspector
I2: BoardManager.Start() skips PlacePieces() when CampaignManager is active (SetupBoard will place pieces instead)
This commit is contained in:
2026-08-17 16:54:30 -03:00
parent 0def9769ef
commit 31e70b1bcf
2 changed files with 21 additions and 2 deletions
+16
View File
@@ -0,0 +1,16 @@
using UnityEditor;
using UnityEngine;
/// <summary>
/// PropertyDrawer for ReadOnlyAttribute. Shows fields as disabled (greyed out) in the Inspector.
/// </summary>
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
GUI.enabled = false;
EditorGUI.PropertyField(position, property, label);
GUI.enabled = true;
}
}
+5 -2
View File
@@ -57,8 +57,11 @@ public GameObject kingPrefab; // Prefab del Rey usado como "jefe" en el purgator
GenerateBoard();
GenerateIndicators();
// Setup estándar (puede ser reemplazado por SetupBoard con CampaignState)
PlacePieces();
// Skip standard piece placement if CampaignManager will call SetupBoard
if (CampaignManager.Instance == null || !CampaignManager.Instance.IsCampaignActive)
{
PlacePieces();
}
}
/// <summary>