Quantcast
Viewing all articles
Browse latest Browse all 26

Different child position when parent gameobject selected

Hi all, I'm having an issue with the position of a game object child of another. This is the object hierarchy: ![hierarchy][1] I'm dynamically instantiating the "hero" object and then parenting to him the "sphere" objects. After this I move the main "hero(clone)" object containing all its children in the scene. Everything is good until I have to delete everything, save and then re-instantiate the entire object. The process require me to instantiate the "hero" object again, move it again in the position I previously saved and then put on it my spheres (all this programmatically). It looks good at a first impression but when select the "hero(clone)" object the position of its children change: ![left unselected, right selected][2] (the left part rapresents the unselected "hero(clone)" while the right part the selected. After I instantiate the "hero" prefab in the scene (becoming "hero(clone)") I set its position and rotation to the saved values and same thing when I recreate the spheres (i save each sphere coordinates). So if the character is not selected everything seems working but when i select it all is children except for the spheres moves to the position where it was originally spawned the first time. I think it may happen because of something I do during my initialization procedures, but I can't get how is it possible that the same object can store 2 different position coordinates at the same time. I'm not looking for a solution to my bug in the code (because there is one somewhere, i'm sure) but I'd love to read some ideas about how this can be happening. I tried everything that came in my mind and I have very few alternatives left. So thanks to anyone can imagine a reason why this is happening! [1]: /storage/temp/5596-screen+shot+2012-11-01+at+3.56.20+pm.png [2]: /storage/temp/5598-screen.png

Viewing all articles
Browse latest Browse all 26

Trending Articles