Connecting Game Objects to a pane from a spawner in Unity?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

Connecting Game Objects to a pane from a spawner in Unity?



I have a pane with one cube on it with a spawner which will spawn cubes out when the game is played. The pane can be rotated and the cubes should stick to it and move forward.
The part i am stuck on is making the cubes that come from the spawner to stick.



I managed to make the original cube stick using


Object1.transform.parent = Object2.transform;



I also managed to make the spawner stick to the pane using the same method.



However when i use this the first cube will stick fine and the cubes from the spawner are not showing up. From what i have researched it could be a scaling issue. Also the spawned cubes do appear under the cube as "Cube(clone)" but their scale is diffrent to the original cube. I have also noticed the scale of the original Cube changes when i press play. It goes from - (10,10,10) to float numbers.



A solution i tried was to set the scale but when i done this the objects did not stick on to the pane at all.



However they did spawn normally.Using this method.


void Update ()
Vector3 scale = new Vector3(10, 10, 10);
Object1.transform.localScale = scale;
Object1.transform.parent = Object2.transform;



If anyone has any ideas it will be much appreciated.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

Trying to Print Gridster Items to PDF without overlapping contents

Hystrix command on request collapser fallback