Sorry if this is a bit of a beginner question but I am struggling to implement the IAStarAI interface list called by the FormationDestination script. Right now I am calling a list of all units as game objects and trying to get their IAstarAI component but when I run the script it comes back as Null.
The theory is that it would update their individual destinations with a formation destination and would work on units with a different radius unlike FormationPacked. I am not sure if my knowledge of the script or my knowledge of interfaces is what’s failing me here.
Thank you, I have updated that but I still seem to be incorrectly calling the IAstarAI interface wrong. I have tried running it from a list in the controlling script and making lists of 1 from the individual unit scripts and getComponent seems to be just making a Null list when I try to grab IAstarAI. Is there another way I should be making this IAStarAI list? All the game objects are follower entities that I am pulling from. I have also tried defining an IAStarAI variable or not defining one within the game object.
Then you are likely calling GetComponent on the wrong GameObject. You need to ensure you are calling it on the GameObject with the FollowerEntity componnet.
Hm, I am trying it directly in the unit script which is attached directly to the follower entity assigned game object. I am declaring a list of IAStarAI in each unit, adding the one gameObject IAStarAI element to it using get component then passing it to the function which returns to an empty vector3 list which I have tried pre populating with one 0,0,0 value or not. It seems to always say that it is null though. Is this method correct for referring to the followerEntity gameObject?
Well I figured out my error, turns out I just needed to initialize the list as a new list before adding to it. I knew it would be something simple like that. Thanks for talking it through.
Last thing is now that it is running, it does not seem to be taking the radius of the units into account to make sure a new formation would fit there. Is there another parameter it uses to set destinations?