Search Unity

Instantiated Prefab instantiates upside down sometimes?

Discussion in 'Scripting' started by foxvalleysoccer, Apr 18, 2017.

  1. foxvalleysoccer

    foxvalleysoccer

    Joined:
    May 11, 2015
    Posts:
    108
    When I'm looking forward the prefab instantiates correctly facing me the camera on hololens.
    When I turn around the instantiated prefab appears upside down when instantiated?

    This loop runs every 6 seconds.
    How can i fix that so it always appears right side up?

    `
    Vector3 camPos = Camera.main.transform.position + Camera.main.transform.forward;
    tempNumber = Instantiate(ScaryFace) as GameObject;
    tempNumber.transform.position = camPos;`
    yield return new WaitForSeconds(1.0f);
    Destroy(tempNumber);
    _
     
  2. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Normally you should do this: public static Object Instantiate(Object original, Vector3 position, Quaternion rotation

    For example:
    Code (CSharp):
    1. Instantiate(PointerLineSprite, TapLocation.position, Quaternion.identity);