Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
-1
Question by mineus64 · Jul 29, 2013 at 06:45 PM · guiinteractionuser

User-Placeable Objects

Does anyone have a script bit for an OnGUI function, so that OnGUI the game clones a specific prefab and places it into the world a specific distance in front of the player, so that, for example, the user can select a skyscraper from a menu and drop it into the world?

Comment
Add comment · Show 3
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
avatar image VolureDarkAngel · Jul 29, 2013 at 06:49 PM 0
Share

This sounds more like you want someone to build part of your game for you. If your looking for some complete item like this, you may want to check the Asset Store. Or you may google tutorials on similar subjects and extrapolate

avatar image mineus64 · Jul 29, 2013 at 07:01 PM 0
Share

No, I simply need to know how to instantiate a prefab and place it a specific distance in front of you. I already have a prefab. Also, the reason why I am asking this is because I have already googled this and found 3 answers, none of which were relevant.

avatar image mineus64 · Jul 29, 2013 at 07:09 PM 0
Share

Thanks. Please post as an answer so that I can mark it as so, and give you a thumbs up.

1 Reply

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by robertbu · Jul 29, 2013 at 07:07 PM

For the specific question of cloning some distance in front of an objects position:

 Instantiate(someObject, transform.position + transform.forward * someDistance, transform.rotation);
Comment
Add comment · Show 2 · Share
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
avatar image mineus64 · Jul 29, 2013 at 09:54 PM 0
Share

Thanks....

avatar image clunk47 · Jul 29, 2013 at 10:12 PM 1
Share

@$$anonymous$$eus64 If you need to know how to do something this basic, usually someone will direct you to the Unity Script Reference, where you would be able to search for Instantiate and find what you need to know. You can usually figure it out faster this way than waiting on a legit answer like this one. And if you ask "Does anyone have a script" or "write me a script" or pretty much anything else making it look like you want someone to do the work for you, some people downvote you. Not trying to badger you, just giving advice. Happy developing.

@robertu +1

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.

Follow this Question

Answers Answers and Comments

18 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

Related Questions

Simple Menu(understanding GUI) 2 Answers

Individually rotate GUI Elements? 4 Answers

user add on screen text 2 Answers

How to use GUIUtility.hotControl? 0 Answers

How to make a Cube act as a button to increment a number on a screen overlay panel in an FPS? 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