How do i set a gameobject variable without setting it in the explorer

Hello, I am trying to make a script that spawns walls around a parent object. These will be spawned in randomly generated levels, so naturally I cannot set the prefab to spawn (a wall) myself. How can I get an existing asset in a script to use it this way?

You still can. If you have a prefab asset that references another prefab asset, and you instance the former prefab, the instances will still be referencing the latter asset.