Getting to know the interface of logic editor
Blockly
To open the visual scene logic editor, go to the project page and click on the puzzle icon next to the scene
The following window will open where:
- Workspace
- Block Library
- Blockly toolbar
Workspace
A logical structure of the scene - a script - is created in the workspace
Navigation in the editor
To see all the available keyboard shortcuts, in the Logic Editor mode, in the lower left corner of the screen, click the question mark icon with the left mouse button:
The Blockly editor supports the use of keyboard shortcuts:
Action | Keyboard Shortcut |
---|---|
Shortcuts in Blockly | |
Save | Ctrl + S |
Search | Ctrl + F |
Select all blocks | Ctrl + A |
Duplicate block | Ctrl + D |
Cut Block | Ctrl + X |
Copy Block | Ctrl + C |
Paste Block | Ctrl + V |
Zoom | MMB up |
Move | MMB down |
Create new tab | Ctrl + T |
Fast to change tab | Ctrl + 1...9 |
Delete a block | Del / Backspace |
Undo the previous action | Ctrl + Z |
Redo the previous action | Ctrl + Shift+ Z |
Turn on/turn of fullscreen mode | F11 |
Workspace controls
In order:
- Expand editor to full screen
- Focus on the center of the work area. The center is determined by existing blocks
- Zoom in on workspace
- Zoom Out Workspace
- Trash from which you can restore recently deleted blocks and groups of blocks
Search by objects
In the logic editor, there is a search for blocks by objects in the workspace located on the stage. To call it, you must press the key combination Ctrl + F
- Jump to the previous search result
- Move to the next search result
- Case-sensitive search - search results become dependent on the input of upper or lower case characters
For example, if you want to find “block 1” and in the search write “Block 1” using case sensitivity, then you will not find “block 1”
- Search by words - the search occurs only for the entered words
For example, if you want to search for “Player” and start spelling the word, the result will not be shown until the word is entered completely
- Close search box
Block context menu
Right-clicking
on a block opens the context menu of the block, allowing you to:
- Duplicate Block
- Add a comment to a block
- Insert inside/outside
This function changes only the visual display of the block
- Collapse/expand block
- Disable block
- Delete block or group of blocks
Block Library
The script is assembled from the blocks in the block library. All blocks are grouped into sections according to their purpose: “Logic”, “Actions”, etc.
For objects located on the stage, in the “Objects” section, subsections are created according to the type of objects
You can read more about block types in the corresponding article
Block search
Blocks are searched at the top of the block library. The search works for the names of blocks and objects from the scene
Blockly toolbar
The toolbar allows:
- Apply Changes
- Cancel changes
- Switch to VR Scene Preview
- Switch to scene preview on PC
- Go to scene edit mode on PC
- Open code (recommended for experienced programmer users)
Highlighting blocks in use
For the convenience of the user, a function was developed to highlight active blocks that are currently being executed in the project. This is useful for debugging and identifying errors in a script
In this example, two blocks are selected at once:
- An event block that reacts to the collision of objects on the stage. This happens because when the scene starts, we animate the cube by moving it to the side where the sphere is. Therefore, it turns out that at the moment the cube collides with another object, this block is triggered
- An event block that includes a construction of action blocks on three objects: a cone, a cube, and a sphere
Working with logic of deleted object
When deleting an object from the 3D scene, the user will see a message stating that this “Object is used in logic. Do you want to delete it?”
If you delete such an object, then all the logic associated with this object will stop working and the blocks of this object will become inactive
However, if you place a new object of the same type as the old one and name it the same, all related logic is reanimated and will work correctly