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
0
Question by fbic333 · Feb 22, 2014 at 04:07 AM · randomspawnrespawnlocation

Spawn One Game Object In A Random Location After Object Has Been Used

Hey guys, this is my first question to ask the community so bear with me. I am creating a game where a pillar shows up on the battlefield and the player must interact with it before it respawns to another location. My question is; where do I start to just make the object show up in one spawn location, then appear in another? I appreciate any help given. I am not an experienced programmer but I do understand the basics of C#.

Comment
Add comment · Show 4
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 robertbu · Feb 22, 2014 at 04:10 AM 0
Share

Rather than respawn anything, just hide/show/move the object. Research:

 Transform.position
 Renderer.enabled
 Collider.enabled

You may want to look at colliders, triggers, OnTriggerEnter() for interacting with the pillar.

avatar image fbic333 · Feb 24, 2014 at 12:37 AM 0
Share

Wow thanks guys. Those are great places for me to start. I appreciate the help.

avatar image fbic333 · Mar 06, 2014 at 05:36 AM 0
Share

If the object is hidden will the players or AI run into it?

avatar image robertbu · Mar 06, 2014 at 06:14 AM 0
Share

If you turn off the collider, then neither the player or the AI will run into it. Note you could also disable it completely with GameObject.SetActive(). The only issue with disabling something completely is that many of the functions used to find game object will not find a disabled object.

1 Reply

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

Answer by mattyman174 · Feb 22, 2014 at 04:10 AM

Use the Objects transform position to set a new position for it.

 transform.position = newLocationAsAVector3;
Comment
Add comment · Show 1 · 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 fbic333 · Mar 25, 2014 at 11:58 AM 0
Share

Have not tried this yet but have seen it in action. Will probably use this come time. Thank you.

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

19 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

Related Questions

C# Random spawn from an array 0 Answers

[solved] respawn when destroyed 1 Answer

Randomly Initiate Cubes - Prevent Same Position 0 Answers

Respawn random objects 1 Answer

Spawn Objects at Different Locations with Tags? 2 Answers


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