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 jorgon · Sep 16, 2011 at 08:35 PM · instantiateparticles

A question related to the explosion after creation of debris

Hi mates!.

The fact is that I've got an object which disappears after clicking on it thanks to the first script. Then I apply another (the second) script which makes possible that a debris fall down from the disappearing position and I wanted to make, between these phases, an explosion or some particles effect.

So I created in the second script (which creates the debris) an instance of the particles effect at the same time (I suppose it) I create the debris.

But there's no effect. It doesn't work.

I receive a message through teh console like this: "UnassignedReferenceException: The variable explosion of 'newspam' has not been assigned. You probably need to assign the explosion variable of the newspam script in the inspector."

It must be something very simple.

Here's my code:

 // Instantiate a rigidbody then set the velocity
 var projectile : Rigidbody;
 var explosion : Transform;
 function Update () {
 // Ctrl was pressed, launch a projectile
 if (Input.GetButtonDown("Fire1")) {
 // Instantiate the projectile at the position and rotation of this transform
 var clone : Rigidbody;
 var humo : Transform;
 clone = Instantiate(projectile, transform.position, transform.rotation);
 // Give the cloned object an initial velocity along the current
 // object's Z axis
 clone.velocity = transform.TransformDirection (Vector3.forward * 2);
 humo = Instantiate(explosion, transform.position, transform.rotation);
 }
 }

Thanks in adavance.

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 syclamoth · Sep 18, 2011 at 05:20 AM

You need to drag and drop your explosion prefab onto the script component in the editor! It looks like it hasn't been assigned properly (Which, coincidentally, is exactly what that error message told you).

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 jorgon · Sep 18, 2011 at 09:16 AM 0
Share

Thank you very much!. It works!! ;-) . I was wondering how to vote people who help me.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

NullReference on trying to instantiate a prefab which has been set using scriptable object,Particle giving null reference but works in scene view 0 Answers

Instantiating a prefab facing away from it's collision point? 1 Answer

OnParticleCollision registering twice? 1 Answer

How to Destroy Particle System after Instantiating,How to destroy a particle system that was just spawned? 1 Answer

Wrong particle and prefab spawn position 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