{"action":"closed","issue":{"url":"https://api.github.com/repos/svermeulen/Zenject/issues/425","repository_url":"https://api.github.com/repos/svermeulen/Zenject","labels_url":"https://api.github.com/repos/svermeulen/Zenject/issues/425/labels{/name}","comments_url":"https://api.github.com/repos/svermeulen/Zenject/issues/425/comments","events_url":"https://api.github.com/repos/svermeulen/Zenject/issues/425/events","html_url":"https://github.com/svermeulen/Zenject/issues/425","id":306157789,"node_id":"MDU6SXNzdWUzMDYxNTc3ODk=","number":425,"title":"Manipulating transform after InstantiatePrefab has unstable behavior","user":{"login":"ErikDeRoos","id":17176362,"node_id":"MDQ6VXNlcjE3MTc2MzYy","avatar_url":"https://avatars0.githubusercontent.com/u/17176362?v=4","gravatar_id":"","url":"https://api.github.com/users/ErikDeRoos","html_url":"https://github.com/ErikDeRoos","followers_url":"https://api.github.com/users/ErikDeRoos/followers","following_url":"https://api.github.com/users/ErikDeRoos/following{/other_user}","gists_url":"https://api.github.com/users/ErikDeRoos/gists{/gist_id}","starred_url":"https://api.github.com/users/ErikDeRoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErikDeRoos/subscriptions","organizations_url":"https://api.github.com/users/ErikDeRoos/orgs","repos_url":"https://api.github.com/users/ErikDeRoos/repos","events_url":"https://api.github.com/users/ErikDeRoos/events{/privacy}","received_events_url":"https://api.github.com/users/ErikDeRoos/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-17T13:47:22Z","updated_at":"2018-09-30T11:36:23Z","closed_at":"2018-09-30T11:36:23Z","author_association":"NONE","body":"I am currently replacing my non-DI code to use the Zenject DI system.\r\nI am having very strange prefab instantiating behavior when using Zenject to do the instantiating.\r\n\r\nThis was the old code:\r\n`var newGameObject = GameObject.Instantiate(blueprint, onSpawnPoint.Position, onSpawnPoint.AngleForSpawn) as GameObject;`\r\n\r\nI replaced it using the IInstantiator service:\r\n`var newGameObject = _instantiator.InstantiatePrefab(blueprint);\r\nnewGameObject.transform.SetPositionAndRotation(onSpawnPoint.Position, onSpawnPoint.AngleForSpawn);`\r\n\r\nThis caused the instantiated objects to spawn on just a few of the given positions, inside each other or grouped tight around a those positions, and even a few just standing at 0,0\r\nThis behavior was static: always the same pattern.\r\n\r\nThis strange behavior disappeared again when i use the DiContainer service to do the injecting manually:\r\n`var newGameObject = Object.Instantiate(prefab, position, rotation) as GameObject;\r\n_diContainer.InjectGameObject(newGameObject);`\r\n\r\nI tried to find out what the _instantiator.InstantiatePrefab(blueprint) was doing under the hood but couldn't make sense of it. There is a lot of unnecessary parenting being done (for my case it is) but I could not find a hint why it has that seemingly random effect of applying the transforms to the wrong objects."}}
{"actor":{"display_login":"svermeulen"}}