Hello there, I had been struggling with unitys GetComponent for quiet some time now.
Code:
ScriptABC abc = (ScriptABC) collidedObject.collider.gameObject.GetComponent(typeof(ScriptABC));
When i use the above line in collision detection code, all i get is the below error :(
Cannot convert type 'UnityEngine.Component' to 'ScriptABC'
ScriptABC is not a Monobehavior and I want to access some methods exposed in that script.
abc.GetLife() and so on
This error doesnt leave me to proceed !
Any ideas?
Thanks folks!