- Home /
Question by
Shivang_Purwar · Sep 03, 2018 at 10:31 PM ·
scripting problemprefabsinstantiate prefabclones
my prefab clone object are falling from ground in y direction?
I deleted my game objects and created there prefabs and instantiate each prefab of clone, but in game my clone game object falls in y direction( in the screenshot my prefab object pins and ball both are not in there initial position and falling from the lane. How can i solve this problem? Here is my code....
public class GameManager : MonoBehaviour {
public GameObject ballprefab;
public GameObject[] pinprefab;
public GameObject cameraprefab;
public GameObject maincameraprefab;
void SwanAll()
{
for(int i = 0; i<10; i++)
{
Instantiate(pinprefab[i], pinprefab[i].transform.position, pinprefab[i].transform.rotation);
}
Instantiate(ballprefab, ballprefab.transform.position, ballprefab.transform.rotation);
Instantiate(cameraprefab, cameraprefab.transform.position, cameraprefab.transform.rotation);
Instantiate(maincameraprefab, maincameraprefab.transform.position, maincameraprefab.transform.rotation);
}
private void Awake()
{
SwanAll();
}
}
[1]: /storage/temp/123886-unity-question.jpg
unity-question.jpg
(113.5 kB)
Comment
Your answer
Follow this Question
Related Questions
Instantiate is spawning too many clones 2 Answers
create a button with name and text for every game object with tag 0 Answers
Prefab error while using Network.Instantiate 0 Answers
instantiated gameobjects(clone) don't behave like its original gameobject. 1 Answer
(Re-posted) How to save multiple of the same prefab clones 0 Answers