• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by awkwardstreamer · Dec 23, 2020 at 11:15 PM · instantiate prefab

is there difference between an instantiated prefab and one thats been manually dragged into the scene?

hi there, Im making a VR game and my player prefab is obviously a little more complex than normal with the different colliders and sprites that are on the actual player. If i Drag my player in, doesnt matter if it 20 feet above ground, underneath the ground, it always works properly. But when i instantiate the very same prefab somehow my inventory is either 10 feet above or below me. It seems almost like the different object collide separately and it offsets the position of the children of the prefab... Im honestly stumped... I am trying to create a random Player start position... a simple idea... but apparently not for me. seems to have to do with the prefabs relationship with the children object any help would be greatly appreciated.

 public GameObject player;
 public Vector3 startPos1;
 public Vector3 startPos2;
 public Vector3 startPos3;
 public Vector3 startPos4;

 private Vector3 SpawnPos;

 public int ranNum;
 // Start is called before the first frame update
 void Start()
 {
     startPos1 = GameObject.Find("PlayerStart1").transform.position;
     startPos2 = GameObject.Find("PlayerStart2").transform.position;
     startPos3 = GameObject.Find("PlayerStart3").transform.position;
     startPos4 = GameObject.Find("PlayerStart4").transform.position;
     PlayerDrop();
 }
 public void PickYourPlace()
 {
     ranNum = Random.Range(1, 5);
     if(ranNum ==1)
     {
         SpawnPos = startPos1;
     }
     if (ranNum == 2)
     {
         SpawnPos = startPos2;
     }
     if (ranNum == 3)
     {
         SpawnPos = startPos3;
     }
     if (ranNum == 4)
     {
         SpawnPos = startPos4;
     }
 }
 void PlayerDrop()
 {
     PickYourPlace();
     Instantiate(player, SpawnPos, Quaternion.identity);
 }

}

heres a picture showing in the very first frame the two prefabs are not identical, blue is the prefab i manual place and red is the instantiated one. hard to tell but you can see the orientation of certain objects or offalt text

deadluck-qvr-02-pc-mac-linux-standalone-unity-2019.png (270.4 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

110 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Accessing a Function from an Instantiated Object 1 Answer

Instantiated objects, not reacting to lighting 1 Answer

PhotonNetwork.Instantiate is not "buffered" 0 Answers

Prefab instantiating at wrong position 3 Answers

Not instantiating certain prefabs in WebGL build but works fine in Unity Editor 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges