- Home /
Problem is not reproducible or outdated
Instantiated objects always at position 0,0,0
I'm an experienced coder with a published game so please excuse me for asking a question that I'm sure will have a simple answer! But I've just started working with Unity and I've spent the last 24 hours tearing my hair out over something that I just don't understand...
When I use a script to instantiate a prefab it is locked to position 0,0,0. I can't spawn it at a different position, and can't move it. If I spawn GameObjects then they appear exactly where I tell them to be, and I can move them around. I must have read 20+ tutorials showing every slight variation of instantiation code, but no matter how I write the code I get the object created but locked to 0,0,0.
I know I'm missing something fundamental so I'm not even including any code because I'm sure someone can immediately tell me it's a prefab property or a project setting etc. What's really puzzling me though is that I've searched and searched help forums and nobody else appears to have had the same problem???
Can someone please throw me a clue? :-)
Thanks in advance. I will of course be staying around to help others as I get to grips with Unity.
I've never experienced or heard about that, are you using Unity 3.5? Are you confident that no other script is interacting with your GameObjects? Could you post the code? ;)
As is so often the case, I think I've found the answer straight after asking the question Apparently there is an incompatibility between some versions of Blender and some versions of Unity. (I'm using Unity 3.5 and Blender 2.61) If a prefab is created from an FBX object exported from Blender, and the versions of Unity and Blender you're using don't quite match up, then you get this problem with the prefab being locked to 0,0,0. Hours and hours wasted because of what amounts to a bug in Unity :-(
I was just about to ask this same question until i saw this post. I am having the exact issue, and can confirm that it indeed an issue with Unity 3.5 and blender 2.61. A quick work around that I have found is to spawn a cube and then switch out the mesh being rendered by the renderer. Not a perfect solution at all but at least gets you back in the game
As the question is closed I cannot add a new answer but one good workaround is not to use the prefab as imported from Blender but make a new prefab and make its mesh the mesh that you wish.
This isn't a bug, it's the Animation component; I answer this like twice a week. Animations contain positional information - you have to not export position animation or you have to remove the animation component or you have to child the animated object to something not animated.
Follow this Question
Related Questions
Instantiate in Editor 1 Answer
Issue Instantiating prefab in C# 2 Answers
Player instantiates Backwords 0 Answers