# \[Tutorial\] Logical connections/Paths/Colorful Lines only visible in Editor

**URL:** <https://forums.unrealengine.com/t/tutorial-logical-connections-paths-colorful-lines-only-visible-in-editor/216113>\
**Category:** FX\
**Tags:** unreal-engine\
**Created:** [January 25, 2018, 2:05am UTC](https://forums.unrealengine.com/t/tutorial-logical-connections-paths-colorful-lines-only-visible-in-editor/216113 "2018-01-25T02:05:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CraftyWeazel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CraftyWeazel](https://forums.unrealengine.com/u/CraftyWeazel)\
**Post date:** [January 25, 2018, 2:05am UTC](https://forums.unrealengine.com/t/tutorial-logical-connections-paths-colorful-lines-only-visible-in-editor/216113/1 "2018-01-25T02:05:16Z")

</div>

Hello there ! I’ve been developping some nice things to be able to better visualize logical behavior of our scenes when my team and me are designing some levels. It’s in the context of a 2D puzzle game but you could use these tricks for any kind of projects.

Here, I will show you how I manage to get this result :

[https://forums.unrealengine.com/core/image/gif;base64](https://forums.unrealengine.com/core/image/gif;base64)  
​  
After this, you will be able to place some actors of your creation and link them with these lines that are only visible in Editor (or in game if you want it to).

**Steps :**  
\*\*1 - \*\*Creating the \*Material \*and _ParticleSystem_  
\*\*2 - \*\*Scripting a \*Macro \*setup utility  
\*\*3 - \*\*Adding a line through _Construction Script_ of any _Actor_

**Step 1 : Creating the _Material_ and _ParticleSystem_**

Creating the \*Material \*:  
[ul]  
[li]In a dedicated folder of your _Content Browser_, add a new _Material_ and click twice to edit it.[/li][li]In the main properties of the _Material_, let everything unchanged but _Shading Model_ option that you can set on “_Unlit_”.[/li][li]In the main graph window, add only one node : \*ParticleColor \*and link its first pin (the white one) with the _Emission Color_ pin of the _Material_.[/li][li]Save and wait untill the editor finishes applying the changes. Close the _Material_.[/li][/ul] Creating the \*ParticleSystem \*:  
[ul]  
[li]In the same folder, add a new _ParticleSystem_ and open it in editor.[/li][li]Remove _InitialVelocity_ and _ColorOverLife_ modules, add \*BeamData \*(in _TypeData_), \*Source \*(in _Beam_), \*Target \*(in _Beam_), \*InitialColor \*(in _Color_)and _ScaleColor/Life_ (in _Color_) modules. It should look like this :[/li][/ul]  
[https://forums.unrealengine.com/core/image/gif;base64](https://forums.unrealengine.com/core/image/gif;base64)  
​  
[ul]  
[li]Follow the next steps :[/li][LIST]  
[li]Under _BeamData_, set _Speed_ to 0.[/li][li]Under _Required_, set _Material_ to your new _Material_.[/li][li]Under _LifeTime_, set _Distribution_ to a \*DistributionFloatConstant \*of 0.[/li][li]Under _InitialSize_, set _Distribution_ to a _DistributionVectorConstant_ of 0.5 - 0.5 - 0.5.[/li][li]Under _Source_, set _SourceMethod_ to _Actor_ and _SourceName to “Source”.[/li][li]Under Target, set TargetMethod to Actor and TargetName to “Target”.[/li][li]Right-click on ScaleColor/Life and chose “Set up particle parameter”.[/li][li]Under ScaleColor/Life, set ParameterName to "LineColor"_.[/li][/ul]  
[li]Save your _ParticleSystem_ and close it.[/li][/LIST] We created a particle system that will simply trace a line between two actors : a source and a target. As parameters, you will be able to chose the starting and ending point along with the line color. We will use a _Macro_ and _ParticleSystemComponent_ in the next steps to automatically spawn our editor line.

**Step 2 : Scripting a _Macro_ setup utility**

To help us later when adding editor lines, we will make a new _Macro_ library (you can use one of your own if it inherits from _Actor_ class).  
[ul]  
[li]Create a new _Blueprint Macro Library_ and chose _Actor_ class to inherit from. Open the library in editor.[/li][li]Rename the first _Macro_ “SetupEditorLine”. Add these inputs :[/li][LIST]  
[li]“In” - _Exec_[/li][li]“EditorLine” - \*ParticleSystemComponent \*(_Object_ _Reference_)[/li][li]“Source” - _Actor_ (_Object Reference_)[/li][li]“Target” - \*Actor \*(_Object_ _Reference_)[/li][li]“Color” - _LinearColor_[/li][li]“HiddenInGame” - _Boolean_[/li][/ul]  
[li]Add an _Exec_ output if you want as it will be easier later to script with.[/li][li]Script the macro like shown here :[/li][https://forums.unrealengine.com/core/image/gif;base64](https://forums.unrealengine.com/core/image/gif;base64)  
​  
[/LIST] The purpose of this _Macro_ is to setup the different parameters of a _ParticleSystemComponent_.  
_Tip :_ it’s up to you to use a _Blueprint Function Library_ if you prefer it this way.

\*\*Step 3 : Adding a line through _Construction Script of any Actor_

We now have all we need to add editor lines all over the place ! Let’s explain how we can manage this.

In each blueprint class inherited from _Actor_ you make, there is a _Construction Script_. It runs at the loading of the level in the game, but also each time something changes on an object placed in the level editor. That is to say, if you change a parameter or move an _Actor_ in thescene from the editor, then editor lines will be updated.

Therefore, we are placing our code in the _ConstructionScript_ of any _Actor_ child class. We need to do two simple things : add a _ParticleSystemComponent_ and call our _SetupEditorLine_ macro to set every parameter. Here is an example :

[https://forums.unrealengine.com/filedata/fetch?filedataid=127830&type=thumb](https://forums.unrealengine.com/filedata/fetch?filedataid=127830&type=thumb)

The line will be green, not visible in game and will link the _Actor_ whose script is shown to “_OtherActor_”, a variable you can expose to make it directly editable from editor (using the pipette tool and clicking on another actor in the scene).

_Tip :_ if you want to, you can directly drag-n-drop a editor line _ParticleSystem_ in your level and setup parameters yourself using the “_Expose Parameters_” option.

**And that’s it !** You can use some of the main principles of this tutorial to make a lot of other things, like printing a special sprite only in Editor, making NPC paths visible for the designers, create options to make them visible or not in debug-game… It’s up to you !

Hope this helped 🙂 Bye !
