Commit 12b486c5 by Eko Simanjuntak

bug fix obstacle not change

parent 08f5c2da
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,7 +8,6 @@ public class BackgroundChanger : MonoBehaviour { ...@@ -8,7 +8,6 @@ public class BackgroundChanger : MonoBehaviour {
private List<GameObject> obstacleGroup = new List<GameObject>(); private List<GameObject> obstacleGroup = new List<GameObject>();
private GameObject[] gameObjectGroup; private GameObject[] gameObjectGroup;
private GameObject background; private GameObject background;
private GameObject obstacle;
private string[] colors = {"Blue", "Green" }; private string[] colors = {"Blue", "Green" };
public void Start() public void Start()
...@@ -31,8 +30,11 @@ public class BackgroundChanger : MonoBehaviour { ...@@ -31,8 +30,11 @@ public class BackgroundChanger : MonoBehaviour {
{ {
foreach(string color in colors) foreach(string color in colors)
{ {
obstacle = GameObject.FindWithTag(color + "Obstacle"); gameObjectGroup = GameObject.FindGameObjectsWithTag(color + "Obstacle");
obstacleGroup.Add(obstacle); foreach(GameObject obstacle in gameObjectGroup)
{
obstacleGroup.Add(obstacle);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment