Class BlockHolder
Components that hold Block, hold and manage Block in the scene.
Usually need to be set in the editor or in the script at runtime BlockRoot, which is usually generated by Mega Studio in edit mode. If an unknown block is located at runtime, BlockHolder will automatically generate a BlockController and add it below BlockRoot, and if BlockRoot does not exist, it will be automatically created.
[DisallowMultipleComponent]
public class BlockHolder : MonoBehaviour
- Inheritance
-
BlockHolder
Fields
BlockRootSource
Source of Block root.
public BlockHolder.BlockRootSourceType BlockRootSource
Field Value
MultiBlock
Strategy when locating multiple Blocks. Needs to be set before UnityEngine.MonoBehaviour.Start.
public BlockHolder.MultiBlockStrategy MultiBlock
Field Value
blocks
protected readonly Dictionary<string, BlockController> blocks
Field Value
Properties
BlockRoot
Parent node of all Mega blocks. It is usually generated by the Mega tool. If not set, a new root node will be automatically generated when the first block is held.
public BlockRootController BlockRoot { get; set; }
Property Value
Blocks
All held Mega blocks.
public List<BlockController> Blocks { get; }
Property Value
Methods
GetBlock(string)
Get block.
public BlockController GetBlock(string id)
Parameters
id
Returns
Hold(BlockInfo, LocalTransform)
Hold a block. The Block local transform is set by input parameters.
public BlockController Hold(BlockController.BlockInfo info, LocalTransform transform)
Parameters
infotransform
Returns
Hold(BlockInfo, Location)
Hold a block. The Block local transform is calculated from location.
public BlockController Hold(BlockController.BlockInfo info, Location location)
Parameters
infolocation