Search code examples
unity-game-engineinstallationgameobjectsceneview

gameobject is instantiated in the wrong place in game view Unity


difference between game view and scene view

as you can see from the picture it seems like my game object is being instantiated in the wrong place in my game view while in my scene view it instantiates in the right position anyone can help with this problem ?

Edit: i forgot to say that this only happens to my triple shot my regular shot works fine

my code for instantiation:

 void FireLaser()
    {
         _canFire = Time.time + _fireRate;

        if (_tripleShotEnabled == true)
        {

            Instantiate(_tripleShotPrefab, transform.position , Quaternion.identity);
        }
        else
        {
            Instantiate(_laserPrefab, transform.position + new Vector3(0,1.05F,0), Quaternion.identity);
        }
    }

Solution

  • open the prefab where the bullets are located and and set their position to 0 if you instantiate them