- Home /
Infinite runner: obstacles not initiating correctly after the second time
Developing an infinite runner where obstacles are randomly generated (kind of a Flappy bird clone) I am using prefabs and initiate method from the code. I also use a script to initiate and then destroy the obstacle when out-of-screen The problem is, after the first initiation from the code, script doesn't seem to receive the prefab as which object to initiate, but the gameobject itself. Which in term produces problems.
Does your gameobject variable get unassigned and do you get any errors?
It gets assigned to the gameobject automatically, ins$$anonymous$$d of the prefab And no errors
Your answer
![](https://koobas.hobune.stream/wayback/20220613172653im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
Infinite Runner Tutorial - Destroyer Problem 2 Answers
Programming Movement Momentum 0 Answers
Scrolling level Instantiate after cycle 0 Answers
Enemy Spawning in Infinite Runner 1 Answer