Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Xatoku · Jul 20, 2011 at 01:10 PM · instantiatetransformprefabcharacterdestroy

Destroying & Then Spawning Quickly

I'm thinking about how I'll do a transformation which would involve a Character Prefab switching with Another Character Prefab, but done so in a way it looks like the Play Prefab transformed, and I'm curious if I switch them quick enough will any scripts trying to reach them be affected or will they just find the new one?

Example:

 Destroy(Player1)
 Instantiate(Player2)

Obviously they'd be a little more in depth but is this possible or do I have to create a variable saying that if they're switching than don't look for them? Hard to explain I know but if I got through to anyone please tell me if it's possible.

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

1 Reply

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

Answer by SarperS · Jul 20, 2011 at 02:42 PM

You can keep the prefabs under the same parent object and enable disable them based on the mechanics you want.

 var player1 : GameObject;
 var player2 : GameObject;
 
 player1.active = false;
 player2.active = true;
Comment
Add comment · Show 3 · 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 Xatoku · Jul 20, 2011 at 03:30 PM 0
Share

And in the switch it will go too fast for anything to notice?

avatar image fffMalzbier · Jul 20, 2011 at 03:35 PM 0
Share

if both player looks the same nobody will see it. is a fast action to enable or disable a game-object. You have to take a look in your start() and Awake() function so that if the player is enabled he does not need some extra time to initialize.

avatar image J3-Gaming · Jul 20, 2011 at 04:20 PM 0
Share

This would probably be the best solution

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't remove instantiated prefab 0 Answers

problem whit Instantiate Prefabs position. 0 Answers

How do I duplicate an object to work with a shootemup 0 Answers

Prefab Instantiate children transforming to wrong position 1 Answer

How many time does a prefab takes to load?? 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