Timeline for differing methods of Instantiating GameObjects in Unity (what is the difference?)
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 5, 2017 at 16:26 | comment | added | Big T Larrity | Thanks again mate. No wonder why I suffer with bad frame rate on phone games even when very little is happening. I will try to change my practises from now on | |
| Dec 5, 2017 at 15:37 | comment | added | DMGregory♦ | bullet.transform is very likely more efficient than bulletTransform.GetComponent<Bullet>(). Or you could consider giving Bullet its own methods to handle any firing/positioning so nobody else needs to touch its transform at all. ;) | |
| Dec 5, 2017 at 15:23 | comment | added | Big T Larrity | And I used to Instantiate a bulletPrefab as a Bullet (which is a component of the bulletPrefab, however I found that I was often having to write bullet.gameObject.transform..etc...etc instead of just bullet.transform, so I prefer to to bullet.GetComponent<Bullet>() now. (I'm probably doing wrong here but it is the way i learnt most comfortably.) Again tho, thanks for your detailed and easy to understand explanations @DMGregory | |
| Dec 5, 2017 at 15:17 | vote | accept | Big T Larrity | ||
| Dec 5, 2017 at 3:42 | comment | added | Draco18s no longer trusts SE | Oh, nice about the diamond method. I think I was vaguely aware that those methods existed, but I should start using them more. | |
| Dec 5, 2017 at 2:44 | history | answered | DMGregory♦ | CC BY-SA 3.0 |