Disabling and Enabling Blocks in VEXcode VR

VEXcode VR allows users to disable and enable blocks within their projects. This is a useful feature for testing or debugging a project without having to take the project apart. The user can disable or enable a block(s) to test the differences in the robot’s behavior when that block is or is not in the project.


How to disable and enable blocks

Context menu with Disable and Enable block options in VEXcode VR

To disable a block, right-click or long-press on the block to activate the Context Menu and then select Disable Block.

Context menu showing Disable Block option for a selected VEXcode VR block

To enable a disabled block, activate the Context Menu for that block and select Enable Block. 


What happens to individual blocks when disabled

Block shown as disabled in the VEXcode VR workspace

While a block(s) is disabled, it is shown grayed out with a grid of diagonal lines over it.

The disabled block is treated like a comment. It has no effect on the flow of the project.

In the example project, the robot will not wait after driving in reverse, but will immediately turn right.


What happens when a block with nested blocks is disabled

Block settings menu showing Nested Blocks disabled

When you disable a block with blocks nested within it, all of the blocks are disabled. Blocks like a loop or if-then-else conditional, that have nested blocks, can be disabled in the same way a single block can. 

Activate the Context Menu of that loop or conditional Control block, and then select Disable Block. 

Disabled Repeat block in the VEXcode VR Blocks palette

This image shows what happened when the repeat loop was disabled. The loop and the two blocks inside of it were all disabled.

Blocks palette showing the Main block enabled in VEXcode VR

You can enable the main block and all nested blocks within it by activating the Context Menu of the main block and selecting Enable Block.

Disabled Main block in the VEXcode VR workspace

When the main block is enabled, all nested blocks will also be enabled.


Disabling and enabling a single nested block

Block context menu with options to disable or enable a block

You can disable single blocks within a loop or if-then-else by following the same steps for disabling any other block: activate that block’s Context Menu and choose Disable Block.

Here is an example of only disabling a single block within a loop.

Context menu with Disable Block and Enable Block options for a selected VEXcode VR block

The Context Menu for the main block will not provide an option for enabling the nested block because the main block was not disabled.

Disabled block inside an active block stack in VEXcode VR

If later you want to enable that nested block, you will need to activate its Context Menu.


Disabling a “hat” block

Context menu with Disable Hat option selected to disable the block

You can disable an entire stack of blocks by disabling the “hat” block that contains them all.

Activate the Context Menu of the “hat” block, and then select Disable Block.

Disabled When Started block shown inactive in the VEXcode VR workspace

This image shows what happened when the When Started “hat” block is disabled. All of the blocks contained under the When Started block will not run.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: