Exemplo n.º 1
0
    public void SaveBlock()
    {
        BlockSpecs copy = Instantiate(BlockSpecs);

        UnityEditor.AssetDatabase.CreateAsset(copy, $"Assets/Prefabs/Blocks/{blockSpecs.displayName}.asset");
        UnityEditor.AssetDatabase.SaveAssets();
        UnityEditor.AssetDatabase.Refresh();
    }
Exemplo n.º 2
0
 private void CheckForSpecsFileChange()
 {
     if (BlockSpecs != blockSpecs)
     {
         UnsubscribeBlockSpecs();
         BlockSpecs = blockSpecs;
         SubscribeBlockSpecs();
     }
 }
Exemplo n.º 3
0
    public void ResetFields()
    {
        BlockSpecs specs = blockCreator.BlockSpecs;

        for (int i = 0; i < transform.childCount; i++)
        {
            transform.GetChild(i).GetComponent <BlockSettingsUI>().ResetToDefault();
        }
    }
Exemplo n.º 4
0
 public void CreateNewBlock()
 {
     UnsubscribeBlockSpecs();
     blockSpecs = ScriptableObject.CreateInstance <BlockSpecs>();
     BlockSpecs = blockSpecs;
     displayBlock.CreateBlockFromSpecification(BlockSpecs);
     SubscribeBlockSpecs();
     BlockSpecs.OnValidate();
     onCreateNewBlock.Invoke();
 }
Exemplo n.º 5
0
 public void CreateBlockFromSpecification(BlockSpecs specification)
 {
     blockSpecification = specification;
     UpdateBlock();
 }