• 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 /
This question was closed Apr 30, 2013 at 07:35 PM by Loius for the following reason:

The question is answered, right answer was accepted

avatar image
Question by Hjalpmovie · Apr 17, 2013 at 12:50 PM · javascriptnoobrespawn

How do I make a respawn system?

I am new to Unity3d and I'm making a game called "The Capsules". I have a health system that I made but I can't make a respawn system. I just want a simple code that makes me respawn after my health hits 0. :) My heath code:

var curHealth : int = 100; var maxHealth : int = 100;

var healthtext : GUIText;

function Start () {

healthRegen();

}

function Update () {

healthtext.text = curHealth + " / " + maxHealth;

if(curHealth < 0 ) {

curHealth = 0;

}

if(curHealth > 100) {

curHealth = 100;

}

if(Input.GetKeyDown("e")) {

curHealth -= 1;

}

}

function healthRegen () {

for(i=1;i>0;i++) {

yield WaitForSeconds(2.5);

if(curHealth < maxHealth) {

curHealth++;

}

}

}

...sorry, I know it is long. Please, I know I'm a noob. :(

~Max

Comment

People who like this

0 Show 1
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 Loius · Apr 17, 2013 at 01:38 PM 0
Share

this question is exactly the same as every other question with 'respawn' as a tag

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by GamingNewBie · Apr 17, 2013 at 01:14 PM

Honestly i do not understand what actually you are trying to say. If you are looking to respawn or instantiate a game object, look into the following Url. http://docs.unity3d.com/Documentation/ScriptReference/Object.Instantiate.html Please explain your problem a bit more, so people here can help.

Comment
Loius

People who like this

1 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 Hjalpmovie · Apr 30, 2013 at 07:15 PM 0
Share

No, It's ok, I fixed it 2 hours ago! :D

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

13 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

Related Questions

Multiple Cars not working 1 Answer

help with character respawn after death (javascript) 1 Answer

Pause Button Help 2 Answers

Need Help Understanding Script! (Javascript) 1 Answer

How can i make the ray cast don't go through the walls 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