I've invented an innovative, new game mechanic for Bricker Breaker Quest and want to create a quick prototype to recruit a game development team. After wasting a week researching the best way to easily represent the simple level data, I reluctantly started using Scriptableobjects. Each level is defined as a List<Block>
, where :
public class Block : MonoBehaviour, IComparer<Block>
{
public int x;
public int y;
public int lives = 0;
private int pastLife = 0;
private SpriteRenderer spriteRenderer;
private TextMeshPro text;
private void OnCollisionEnter2D(Collision2D collision)
{
lives--;
if (lives > 0)
UpdateVisualState();
else
{
gameObject.SetActive(false);
}
}
private void Awake()...
public void AddLives(int life)...
}
How do I properly serialize the Block object so that I can enter the X, Y, and Lives integers directly in the Inspector? As a quick hack, I created a List<Vector3Int>
instead of the Block List and use the Z input field to enter the lives. Seems like overkill to create a PropertyDrawer just to relabel one field.
Any other advice is appreciated.