Instantiate an enemy, best way to initialize behavior variables

I use Wave.js to Instantiate a few enemies at regular intervals. I need a good way to initialize the position of each as well as the path it will follow (multiple enemies follow the same path, but start staggered in position).

I cannot send parameters to Start(). I know of the SendMessage and GetComponent(ScriptName) possibilities.

I want to send the starting value (either x or y, depending on the math), the path it will follow (an integer) and some coefficients for my polynomials so the enemy can be self sufficient.

How do you suggest I initialize variables for these enemies after I Instantiate them?

There are a couple of possibilities.

  • Assign all of the enemies as children of a manager object, instantiate in the parent Start().
  • SendMessage also works, as does GetComponent. Here’s a really good summary of GetComponent
  • Arguably the ‘best’ (performance-wise) is to use delegates. Here is a great article about using delegates in a FSM. It may have info you don’t need, but may actually point you in the direction of a great, efficient pattern.

I hope I haven’t misunderstood the type of information you’re looking for, and if so, I’ll rework. But those articles should explain to you the ups and downs of the various methods you mentioned.