I want to draw line between all listener with gizmos. However, there is a problem that gameObject is null.
I found that it only success for the listeners with "GameObject" method, but not other custom scripts. Is there any way to fix it? Thanks.
Here's my code
private void OnDrawGizmos()
{
Gizmos.color = Color.green;
for (int i = 0; i < UnityEvents.GetPersistentEventCount(); i++)
{
GameObject go = UnityEvents.GetPersistentTarget(i) as GameObject;
Gizmos.DrawLine(this.transform.position, go.transform.position);
}
}