How to add a physics material to an imported object's generated mesh?

My problem is I cannot apply a physics material to a prefab that is an imported model. The problem appears to be how Resources.Load() is working. The reason I say this is because when I change the prefab variable in the script to public and assign it through the Unity Inspector, everything works fine. I do not want to do it this way because I will need to load and unload the resource during the game’s run-time.

 void Start ()
 {
      m_GroundPrefab = (GameObject)Resources.Load("LevelName_GroundPlane",typeof(GameObject));
      EventManager.instance.AddListener(this as IEventListener, "ChangeStateEvent");
      m_qGroundPlanes = new Queue(m_nNumberOfPlanes);
      m_vStartPosition = new Vector3(0f,0f,-2f);
      m_vPositionOffset = new Vector3(6.3f,0f,0f);
 
      for(int i = 0; i < m_nNumberOfPlanes; i++)
      {
           m_qGroundPlanes.Enqueue((GameObject)Instantiate(m_GroundPrefab,m_vStartPosition,Quaternion.Euler(new Vector3(0f,180f,0f))));
           //m_qGroundPlanes.Peek().AddComponent();
           m_qGroundPlanes.Peek().collider.material = new PhysicMaterial("pMat_GroundPlane");
           m_qGroundPlanes.Peek().collider.material.dynamicFriction = 1f;
           m_qGroundPlanes.Peek().collider.material.frictionCombine = PhysicMaterialCombine.Average;
           m_qGroundPlanes.Peek().collider.material.bounciness = 1f;
           m_qGroundPlanes.Peek().collider.material.bounceCombine = PhysicMaterialCombine.Average;
           m_qGroundPlanes.Peek().SetActiveRecursively(false);
      }
      enabled = false;
 }

As you can see, I want to load the imported object from the Resources folder and subsequently use it as a prefab to generate my ground plane. If I remove the portion of code that attempts to add a physics material, the collision works fine. When I attempt to add it I get this error: MissingComponentException: There is no ‘Collider’ attached to the “LevelName_GroundPlane(Clone)” game object, but a script is trying to access it. Also, if I leave the “AddComponent” portion in, it returns saying the object already has a collider.

Is it possible to add a physics material to an imported object like this? If so, any help would be appreciated. Thanks.

I would try setting the return of Instantiate to some local variable, modify it there, then Enqueue it. See if that helps.

You don’t want the PhysicsMaterial in the prefab why? Can’t you put it there and then assign its values after you Instantiate it?