☄️Tips & Code Examples
v1.0
Getting an OverlayIcon
at Runtime
OverlayIcon
at RuntimeIf you're customizing things, such as adding a UI Health Bar to your icons, you may need to access the OverlayIcon
component at runtime associated with your object, but it won't be created until the game starts.
We can use a coroutine to grab this just a couple frames after Start()
. You can also do additional logic and plumbing at that point as well.
Get Distance to the Target
Assuming you have access to the OverlayIcon
as shown above, you can get the distance to the target. Additional members can be found on the Overlay Icon page.
Check if Icon is on Screen, on Edge, or in Transition
The OverlayIcon
handles both screen and edge overlay, and there's a period between the two where it will transition.
Last updated