Class BlockHolder
A component that holds Blocks, holding and managing Blocks in the scene.
Usually needs to be set in the editor or in runtime scripts for BlockRoot, which is usually generated by Mega Studio in edit mode. If an unknown block is located during runtime, BlockHolder will automatically generate a BlockController and add it under BlockRoot, and if BlockRoot does not exist, it will automatically create it.
[DisallowMultipleComponent]
public class BlockHolder : MonoBehaviour
- Inheritance
-
BlockHolder
Fields
BlockRootSource
Source of the Block root.
public BlockHolder.BlockRootSourceType BlockRootSource
Field Value
MultiBlock
Strategy when multiple Blocks are located. Needs to be set before 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 Mega tools. 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)
Acquires a block.
public BlockController GetBlock(string id)
Parameters
id
Returns
Hold(BlockInfo, LocalTransform)
Holds a block. Block local transform is set by input parameters.
public BlockController Hold(BlockController.BlockInfo info, LocalTransform transform)
Parameters
infotransform
Returns
Hold(BlockInfo, Location)
Holds a block. Block local transform is calculated from the location.
public BlockController Hold(BlockController.BlockInfo info, Location location)
Parameters
infolocation