So I have a game object called random placer, to which I have attached a script of the same name. Here is that script:
using UnityEngine;
public class RandomPlacer : PipeItemGenerator {
public PipeItem[] itemPrefabs;
public override void GenerateItems (Pipe pipe) {
float angleStep = pipe.CurveAngle / pipe.CurveSegmentCount;
for (int i = 0; i < pipe.CurveSegmentCount; i++) {
PipeItem item = Instantiate<PipeItem>(
itemPrefabs[Random.Range(0, itemPrefabs.Length)]);
float pipeRotation =
(Random.Range(0, pipe.pipeSegmentCount) + 0.5f) *
360f / pipe.pipeSegmentCount;
item.Position(pipe, i * angleStep, pipeRotation);
}
}
}
As you can see, I have an array array of PipeItems. I want to add a prefab called “Large Obstacle” to this array but it won’t let me.
Here’s the 3D object with the script attached:
If I try to click and drag the prefab I want to “Item Prefabs” at Element 0, it won’t let me. That little symbol that is a circle with a strike through appears and the item won’t let itself be added to the array. Is there any reason for this? Why wouldn’t the Random Placer object let me put something there?
Thanks.