How do I dynamically call a public method from a different U# script?

Hey there, I’m currently working on a game world for VRChat and can’t seem to figure out how to access another Udon script’s method properly. I’ve followed the guide made by PlayerBush001 regarding calling events from another script (Call a Networked Event on Different Udon# Script - VRChat SDK3.0 - YouTube) but when attempting to have an enemy take damage via their script I receive an Udon runtime error “Object reference not set to an instance of an object”.

I’ve double checked to make sure my method works outside of shooting an enemy and all casts are detected and correctly displayed in the console. It’s only when attempting to access the public method “TakeDamage(Damage)” for the Enemy. The script is also set properly in the Unity inspector as well.

Are there any references in the Udon documentation that I might be overlooking by chance?

I must’ve missed something as I was receiving the error because the script was not pointing to anything even if the script object was placed in the inspector. The correct code is to assign the script after it’s been found on the Enemy:

            if(HitData.transform.GetComponent(typeof(UdonBehaviour)) != null)
                EnemyScript = (DebugEnemyHealth)HitData.transform.GetComponent(typeof(UdonBehaviour));
                Debug.Log($"{} was found and hit."); //Successfully finds BasicEnemy