- Home /
instantiated gameobjects(clone) don't behave like its original gameobject.
I have a gameobject called platform which moves left and right continuously along an axis. For this left and right movement, I have written a script which is attached to another empty gameobject. In the script, I have created a public Gameobject and dragged the platform from the hierarchy into the inspector.
Now I create the prefab of platform by dragging it from hierarchy to project and instantiate it at regular interval. the problem is instantiated gameobjects (clone of platform) dont moves right and left while its original platform still moves.
I want every clone of platform to move. plz help.
Can you show some code on how the platform is moving and how you are instantiating the platform?
Answer by RohitNutalapati · Dec 06, 2018 at 04:24 PM
This is because your script does not have access to the instantiated gameobjects.
Try attaching the movement script to the platform and then create a prefab of the platform. Create a separate script to instantiate platforms and attach to your empty gameobject.
Your answer
Follow this Question
Related Questions
Instantiate is spawning too many clones 2 Answers
How to Instantiate a GameObject from a ScriptableObject piece of script? 0 Answers
How prefab the instance works? 1 Answer
Clicker game instantiate prefab depending on gold per click 0 Answers
Instantiate specific object from "FindGameObjectsWithTag" Array 0 Answers