I have a inventory system having dynamic item buttons. If clicked on one button it can do a certain things if player is in trigger and clicked on proper button. So I made a simple script called ObstacleController and added it on the trigger object the script has this code
void OnTriggerEnter(Collider Other) {
if(Other.gameObject.tag == "Player") {
.
.
.
ObstacleManager[] Backpackdata = FindObjectsOfType<ObstacleManager>();
for(int i =0; i<Backpackdata.Length; i++)
BackPackdata*.SetObstacleInfo (this.gameObject.GetComponent<ObstacleController>());*
}
}
----------
this code also contains some public strings which decide
which of the buttons is proper.
Then I added a ObstacleManager script which just has this SetObstacleInfo method (taking ObstacleController as a parameter) to each button. But now I notice by using debug that the method is never being called and I fail to understand why.
It would be a great help if someone could help me understand what is not calling that part.
----------
P.S. my void Trigger also calls some more function before those lines of codes and those function work great.