- Home /
Instantiate(Cloning) gives no errors but just does not work
I'm working on a project in witch I need to Instantiate(clone) houses, I wrote this code:
public GameObject House;
void start()
{
Instantiate(House, transform.position, Quaternion.identity);
}
I dragged my house prefab into the public GameObject.
This doesn't work, it give no errors, but it just does not spawn in a house.
Please can anyone help me I got stuck with problem for quite some time. I looked up all over the internet but there are no answers for this.
Answer by NPnpNPnpNP · Dec 10, 2021 at 01:21 PM
The name of your function is start
, but should be Start
, it may be why it doesn't do anything : start
is never called.
Answer by MaasBaas · Dec 10, 2021 at 01:30 PM
I've found a solution already, I was messing with the code and if I put the script in a void update loop, it works (I did it with if(Input.GetKeyDown(KeyCode.Space))) I did now just "Instantiate(House)"
Your answer
![](https://koobas.hobune.stream/wayback/20220613050419im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Instantiated clone GameObject spawning at wrong position. 2 Answers
properly rename instantiated objects 2 Answers
Instantiate inactive,Making a GameObject active/instantiate 3 Answers
Update Function not working within a script inside an instantiated prefab! 1 Answer
How do I instantiate only ONCE? 0 Answers