• 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 kolya8kc · Apr 28, 2012 at 12:05 PM · instantiate3dplatformtutorialmanagement

3DPlatformTutorial object instantiation

I'm studying Unity by 3DPlatformTutorial. "LaserTrap" script instantiates sfx if laser beam collides with player or robot. It's done by codeline as follows:

 Instantiate(hitEffect, hit.point, Quaternion.identity);

So the return value on this call is not retained. On debugging, I can see that "LaserHit(Clone)" object appears for a short while in a Hierarchy.

My question is: how is instantiated hitEffect destroyed? Why there's no memory leak here in?

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
Best Answer

Answer by kolya8kc · May 02, 2012 at 09:39 AM

Thanks for your effort, ExTheSea. I found out that "auto-destroy" is achieved by checking "Autodestruct" checkbox in the "Particle Animator" component. Hope it may be helpful for someone...

Comment
Add comment · 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
0

Answer by ExTheSea · Apr 28, 2012 at 05:55 PM

I don't have the tutorial but I think the Effects gets destroyed by another script which is attached to the hitEffect.

In this script should stand something like this:

Destroy (gameObject, destroyTime); // destroyTime is in this case just an integer variable.

Hope this helps.

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Checking if object intersects? 1 Answer

Instantiating GUI text after 2nd object is destroyed 1 Answer

Have object face towards player when instantiated 2 Answers

Lock rotation of an instantiated object to another 1 Answer

how to display grid that display whole number from 1 to 9? how to detect player touch the grid? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges