- Home /
Instantied 2D Prefab Is Invisible
I'm trying to instantiate a 2D Prefab but every time I try it's invisible. If I place it into the scene it's fine, but when I attempt to Instantiate it, it becomes invisible and doesn't do any of the code I tell it to do (currently I have it so when it Instantiates it would fly in a direction like a bullet.
Instantiate(BulletPrefab, FirePoint.position, FirePoint.rotation);
Answer by JxWolfe · Jan 02, 2019 at 10:14 PM
well, my guess is that it's rotated the wrong way, meaning that it would not take up any space when you look at it from the camera. Plus if you want to tell an object what to do you might want to consider using:
GameObject obj = Instantiate(BulletPrefab, FirePoint.position, FirePoint.rotation) as GameObject;
which gives you a reference to your newly instantiated bullet
Or your because of your sorting layer, your bullet may be being displayed BEHIND another object...
Yeah, for some reason it would be instantiated exactly 90.00001 and now it's listening to my code. Thank you.