List inaccessible within function

I have an enemy manager and an enemy behaviour script. EnemyManager reads an XML file to determine what type of enemy to spawn, when, what waypoints the enemy will move to, and how fast it will move between the waypoints. It then instantiates the correct enemy type and calls InitWaypoints in EnemyBehaviour, which then gives the enemy all the information it needs.

Everything to do with the EnemyManager goes fine; for literally no reason, however, the list objects in EnemyBehaviour are inaccessible in InitWaypoints, despite there being no scope issues.

using System.Collections.Generic;

List<Vector2> lvWaypoints;
List<float> lfMoveTimes;

void Start()
  lvWaypoints = new List<Vector2>();
  lfMoveTImes = new List<float>();

public void InitWaypoints (List<Vector2> a_lWaypoints, List<float> a_lMoveTimes)
  for (int i = 0 ; i < a_lWaypoints.Count ; ++i)

_//Right here, nothing in this function works regarding those lists*
I should clarify: code completion acknowledges that the lists exist within that scope, but absolutely nothing within that function will change them. Even ignoring the arguments passed from EnemyManager and just saying lvWaypoints.Add(new Vector2(1,1)), for example, does not do anything within InitWaypoints. The same code works fine if I put it in Start() or Update(), yet this one function refuses to let me either access (Debug.Log) or modify(Add, Remove, anything) anything to do with the list._

What error is thrown? Do some debug logs to show the order in which things are happening, as well as some null checks and count checks. You can solve many issues this way.

When the function executes, you’re sure a_lWaypoints.Count is non-zero? And that the list is non-null?

I may be misremembering, but IIRC, you can call functions on a script in the same frame the object was created before Start is executed.

  1. Instantiate (or enter playmode if pre-existing)…
  2. Call some function on a script on the object in that frame…
  3. That function executes and returns…
  4. (later) Start() is actually invoked on the object…

Thus it may be that whatever invokes the method gets called before Start(). Often my class-scope lists use lazy-instantiation properties to avoid any such kerfuffles:

private List<thing> things;
public List<thing> Things {
  get { if (things==null) things = new List<thing>(); return things; }   
  set { things = value; }