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 MMDCLXVI · Mar 17, 2013 at 09:09 PM · c#respawn

C# Respawn Help

I was wondering if anyone could help me with figuring out how to create a c# respawn script. You see I am using the Free Fantasy AI package available on the unity asset store, there isn't anything in the script to respawn player if he/she dies.

My problem is that I have only being able to create a respawn script in java script and have no clue how you would go around creation one in C#, if anyone could help me in any way that would be great.

Just in case anyone is wondering, this is the respawn script I created in java script... var startPosition : Transform;

 function OnTriggerEnter(theCollider : Collider)
 
 {
     theCollider.transform.position = startPosition.position;
 }

Go dtí an chéad uair eile, slán leat

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 dorpeleg · Mar 17, 2013 at 09:39 PM 0
Share

I could convert your script to C# but all your code does, is moving (the player I guess) from its current position to the start position.

I'm not sure that's really "respwaning".

But if that's what you are looking for, I can give you the C# version of your code.

avatar image MMDCLXVI · Mar 17, 2013 at 09:50 PM 0
Share

Yea thats pretty much all I'm doing really, I mean I know its not the right way to respawn the player, but it works for now. Thanks for the help.

avatar image landon912 · Mar 17, 2013 at 09:55 PM 0
Share

Yes but, if you have health or any other vars, you should just destroy and Instatiate. Unless you have many players being respanwed.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by landon912 · Mar 17, 2013 at 09:57 PM

 Transform startPosition //Creates a var of type Transform named startPosition
 
 void OnTriggerEnter(Collider theCollider){
     theCollider.transform.position = startposition.position;
 }
Comment
Add comment · Show 4 · 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 MMDCLXVI · Mar 17, 2013 at 10:00 PM 0
Share

Thanks for writing the script in C# for me. If I was to try to get a respawn script to work correctly, what would I have to do? I mean I now I would have to destroy the player (game object) and reset the health and another variables but what else would I have to do?

avatar image landon912 · Mar 17, 2013 at 10:23 PM 0
Share

All you would have to do is destroy the player than recreat it in a designated spot. All vars will be reset since the scripts are not the same instance.

avatar image MMDCLXVI · Mar 17, 2013 at 10:32 PM 0
Share

Alright, thanks for the help.

avatar image landon912 · Mar 19, 2013 at 11:39 PM 0
Share

If this sovled the problem click the check next to the answer. :D

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

12 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Respawning without creating Clones 2 Answers

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

Help With Simple Jump Script 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