Hello, I am making an infinite running game, and I need a solution for pooling.
This is what I have so far:
#pragma strict
public class Make
{
function Create(objects : GameObject[], pos : Vector3, rot : Quaternion)
{
var z = Random.Range(0, objects.Length);
objects[z].transform.position = pos;
objects[z].transform.rotation = rot;
}
}
Now I should be able to supply this with an array, a position, and a rotation, and have it work the same way as Instantiate, but without the instantiation.
However, with this line of code;
The create function is not a static function/method of the class Make. You are trying to use an object “Make” without instantiating it first.
var blockMaker = new Make(); // Create new instance of Make class
blockMaker.Create(block, Vector3(i * horizontalSpace, 0, c), Quaternion.identity); // Use instance function/method and get some create on!