Quick help & tips
Highlight Plus has been designed to be used without having to read a long manual. Hover the mouse over the label of any option in the inspector to reveal a tooltip with a short explanation of that option.
This section contains specific instructions or notes about specific features or issues.
Normals Option
Highlight Plus can automatically optimize mesh normal to provide a better result. The available options are:
- Smooth: this will improve the outline effect when using the Fast or High-quality level (not with Highest).
- Preserve Original: in some circumstances you may want to modify your mesh dynamically and also want Highlight Plus to avoid caching that mesh – enable “Preserve Original Mesh” to force Highlight Plus to use the original mesh always.
- Reorient: this will replace existing normal with a vector pointing out from the center of the object. Useful for some 2D geometry or objects without normals.
Note that Highlight Plus won’t never change the original mesh of your objects so these are safe operations.
Highlight when entering a volume
It’s possible to automatically enable/disable highlight effects when object enters/exits a volume. Add a HighlightTrigger component to the object and select “Volume” as trigger mode.
The script uses the OnTriggerEnter / OnTriggerExit events. The volume must have a collider marked as IsTrigger and static. Also, the object entering the volume must have a rigidbody in order for the events to trigger.
Depth Clip option
When using Outline or Outer Glow in high quality mode, the asset relies on the depth buffer to perform proper depth cull or depth clipping. However, when MSAA (integrated antialias) is enabled, the depth buffer is not available at the stage Highlight Plus renders. If you need MSAA in your project and wants depth clipping/culling, you can enable the “Depth Clip” option in the Highlight inspector. This option only is used when Outline or Outer Glow is set to High Quality (the other quality modes work differently and do not require special treatment).
Compatibility of transparent objects with depth clip option
The Depth Clip option is only available for Outline and Outer Glow in High Quality modes. When enabled, the special _CameraDepthTexture buffer is used to clip the effect. This option is useful if you need to use MSAA since enabling MSAA disables depth checking in high quality mode.
Transparent objects do not write to this special texture unless you use this option in GameObject -> Effects -> Highlight Plus -> “Make Transparent Object Compatible With Depth Clip”.
Once you add this feature to your transparent object, make sure you also have “Depth Clip” option enabled in the objects to be highlighted using Outline or Outer Glow in HQ mode.
Compatibility of see-through effect with transparent shaders
If you want the See-Through effect be seen through other transparent objects, their shaders need to be modified so they write to depth buffer (by default transparent objects do not write to z-buffer). To do so, select top menu GameObject -> Effects -> Highlight Plus -> “Add Depth To Transparent Object”.
Note that forcing a transparent object to write to depth buffer will cause issues with transparency.
Masking UI
To avoid Highlight Plus effects show on top of any UI or sprite element, there’re a few options:
- If you’re using URP, you can configure the Highlight Plus Render Feature to execute Before Transparent objects (this way UI and sprites will render on top of Highlight Plus effects).
- Use “Screen Space Overlay” mode for canvas rendering. This mode renders the UI at the end of the render loop so the UI appears on top of any highlight plus effect.
- Use a second camera to render your world-space UI. Set the culling mask of your main camera and the “UI camera” accordingly (so the UI camera only renders the UI) and set the UI Camera clear flag to “Depth only”. Make sure the “Depth” value of the UI camera is greater than the regular camera so the UI camera renders after the main camera. This setup is easy and ensures the world-space UI renders on top of any highlight plus effect.
- Create a panel on your UI and assign the material HighlightUIMask found in HighlightPlus/Resources/Materials. This special material will write to stencil buffers and will prevent Highlight Plus effects from rendering over that panel. This panel won’t be visible, it will just serve the purpose of masking that portion of screen.
Static batching
Objects marked as “static” need a MeshCollider to be highlighted (other collider types won’t work). This required because Unity combines the meshes of static objects so it’s not possible to access to the individual meshes of non-batched objects.
Note: the MeshCollider can be disabled. The only purpose of this collider is to allow Highlight Effect to get access to the original mesh before the merge performed by Unity when scene starts.
Cancelling see-through effect behind certain objects
Add HighlightSeeThroughOccluder script to the object you want to block see-through effects.
The HighlightEffect.isSeeThroughOccluded will return true if any occluder using raycast mode is covering the highlighted object.
Excluding submeshes
Use the SubMesh Mash property to specify which submeshes will be affected by the effect.
By default, a value of -1 means all submeshes. This is a component mask field. The effect does the following test to determine if the submesh will be included:
(1<<subMeshIndex) & SubMeshMash != 0
Examples:
If you want to only include submesh 1 (index 1), set it to 1 (1<<1).
If you want to include only submesh 2, set it to 2 (1<<2).
For submesh 3, set it to 4 (1<<3).
For submeshes 2 and 3, set it to 6 (1<<2 + 1<<3).
In general, this works like the layer mask or culling mask in rest of Unity.
Custom Vertex Transformations
You can apply your own vertex transformations inside the “CustomVertexTransform.cginc” file. The function “ComputeVertexPosition” is used by all Highlight Plus shader so this is a convenient centralized place where to include your custom vertex transforms.
Please note that any addition or change to this file will be lost if you upgrade Highlight Plus.
Controlling which objects can be selected
The Highlight Manager exposes two events, OnObjectSelected and OnObjectUnSelected, which are fired when user selects/unselects objects. These events can be used to cancel a selection or deselection depending on the value returned by the even handler (a Boolean):
using UnityEngine;
using HighlightPlus;
public class ControlExample : MonoBehaviour {
void Start() {
HighlightManager manager = FindObjectOfType<HighlightManager> ();
manager.OnObjectSelected += ValidateSelection;
}
bool ValidateSelection(GameObject obj) {
// Used to fine-control if the object can be selected; return false to cancel selection
return true;
}
}
Custom sorting
Highlight Plus effects render after transparent queue by default in any order. However, you can control ordering of the effects by adding this script to the scene:
using UnityEngine;
using HighlightPlus;
[ExecuteAlways]
public class CustomRendering : MonoBehaviour {
void OnEnable() {
HighlightEffect.customSorting = true;
}
void Update() {
HighlightEffect.effects.Sort(Comparer);
}
int Comparer(HighlightEffect effect1, HighlightEffect effect2) {
float dist1 = effect1.transform.position.z;
float dist2 = effect2.transform.position.z;
return dist2.CompareTo(dist1);
}
}
In this case, the effects will be sorted by the z position. Feel free to sort the “effects” list above according to your needs.