• 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 Michael 12 · Apr 25, 2011 at 08:30 PM · respawnbce0005

Respawn Alien Zombies

OK I'm using a setup very similar to the FPS tutorial where my enemies, in this case "Alien Zombies" start off at "Way Points" but when I kill them they are dead.

How can I have them respawn at the same location they started off from say after 40 seconds or so after they have disolved/destroyed?

Thomas: Do you mean that I add this to my Alien Zombie's dead replacement?

private var dieTime = Time.time; //When it dies private var deadTime = 40.0f; //Time dead

function Update () { if (Time.time > (dieTime + deadTime)) { Instantiate(alienZombiePrefab, transform.position, Quaternion.identity); } }

If I'm following you corectly I get this error: Assets/WeaponScripts/ZombieAlienRespawn.js(7,29): BCE0005: Unknown identifier: 'alienZombiePrefab'.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Thomas Paniagua · Apr 25, 2011 at 08:38 PM

At the start of the robot script run this

var robotPrefab : Transform; // Put the alive robot prefab here

When they die run this script in the dead body.

private var dieTime = Time.time; // When it dies private var deadTime = 40.0f; //Time dead function Update () {

if (Time.time > (dieTime + deadTime)) { Instantiate(robotPrefab, transform.position, Quaternion.identity);

}

Hope it helps :D

}

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 Michael 12 · Apr 25, 2011 at 10:46 PM 0
Share

Thanks $$anonymous$$, I edited my question with my result so I think I'm doing it wrong or miss reading something?

avatar image
0

Answer by Thomas Paniagua · Apr 27, 2011 at 03:41 AM

ohh yeah, i forgot at the start of the script put this line,

var alienZombiePrefab : Transform;

Add this script to your dead robot prefab and in the inspector window you add the alive zombie prefab where it says alienZombiePrefab, hope it helps :D. PS If you wanna work together post it here :D, luck.

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 Michael 12 · Apr 27, 2011 at 01:56 PM 0
Share

What I ended up doing was just making a cuple of empty game objects and placed them in what I figured would be good spawn positions and then just had those spawn a new zombie alien every 200 seconds. That way hopefully my player will have time to run around and explore the level, still have lots of zombies to shoot but hopefully not get over run with them ;)

I'm looking for work myself actually :(

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Spawn only a certain number of enemies over a certain time 2 Answers

Stop Object from deleting HELP ME!!!!!!!!!!!! 1 Answer

Respawn question unanswered 0 Answers

instantiated objects animation making the object reset to 0,0,0?? 1 Answer

Respawn with enemy contact 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