- Home /
Question by
otenyano · Apr 20, 2017 at 09:01 AM ·
androidinstantiateandroid buildinstantiate prefabinstantiation
Instantiating enemies in spawn points not working on Android Build
Hi, I have a problem instantiating enemies in spawn points on android build. Code works in unity editor, but I don't know what goes wrong in android build. Please Help
public GameObject Enemy;
void Awake() {
GameObject[] enemySpawns = GameObject.FindGameObjectsWithTag("EnemySpawnPoints");
int i = 0;
foreach (GameObject spawnPoints in enemySpawns) {
for (int j = 0; j < 5; j++) {
i++;
GameObject enemy;
enemy = Instantiate(Enemy, spawnPoints.transform.position, spawnPoints.transform.rotation) as GameObject;
}
}
}
on editor
on mobile
Instantiation without Spawn point working is working on android
for (int i = 0; i < 10; i++) {
Instantiate(Enemy, new Vector3(i * 2.0F, 0, 0), Quaternion.identity);
}
editor.png
(139.8 kB)
screenshot-2017-04-19-04-26-27.png
(84.2 kB)
Comment
Your answer
Follow this Question
Related Questions
Why is it important to create an empty gameobject for my prefabs? 0 Answers
Instantiated Bullets Not Picking Up Correct Position/Rotation 2 Answers
How to instantiate once when boolean changes 1 Answer
Animation doesn't affect the new instantiated object. 0 Answers
Invalid Android NDK Directory 2 Answers