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 Oriek27 · Aug 13, 2010 at 10:31 PM · fpsfpstutorialrocket

FPS Tutorial part 2 - please help

I'm following the FPS tut, and i have a problem: when i shoot my rocket launcher, the rocket is supposed to explode when it hits something. instead, it just bounces off and flies around for 2-4 seconds before disappearing. there's also an error that says

NullReferenceException: The prefab you want to instantiate is null. UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation) Rocket.OnCollisionEnter (UnityEngine.Collision collision) (at Assets\WeaponScripts\Rocket.js:18)

this is the Rocket.js Script:

// The reference to the explosion prefab var explosion : GameObject; var timeOut = 3.0;

// Kill the rocket after a while automatically function Start () { Invoke("Kill", timeOut); }

function OnCollisionEnter (collision : Collision) { // Instantiate explosion at the impact point and rotate the explosion // so that the y-axis faces along the surface normal var contact : ContactPoint = collision.contacts[0]; var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal); Instantiate (explosion, contact.point, rotation); // And kill our selves Kill ();
}

function Kill () { // Stop emitting particles in any children var emitter : ParticleEmitter= GetComponentInChildren(ParticleEmitter); if (emitter) emitter.emit = false;

 // Detach children - We do this to detach the trail rendererer which should be set up to auto destruct
 transform.DetachChildren();

 // Destroy the projectile
 Destroy(gameObject);

}

@script RequireComponent (Rigidbody)

Comment
Add comment · Show 2
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 Julian-Glenn · Aug 13, 2010 at 10:45 PM 0
Share

have you assigned the explosion GameObject by dragging it on to the exposed var slot in the inspector?

avatar image Oriek27 · Aug 13, 2010 at 10:57 PM 0
Share

yes, i even tried different explosion prefabs. the error is still there and it stll doesent work

1 Reply

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

Answer by 3dDude · Aug 13, 2010 at 10:48 PM

when you click the rocket prefab in your project folder in the rocket script make sure that the explosion var is set to something......... there should be a explosion prefab in your standard assets drag this prefab into the empty var slot.....

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 Oriek27 · Aug 13, 2010 at 10:57 PM 0
Share

i did that, even trying different explosion prefabs. the error is still there and it stll doesent work

avatar image 3dDude · Aug 13, 2010 at 11:29 PM 0
Share

is there a smoke particleSystem as a child of the rocket?

avatar image Oriek27 · Aug 13, 2010 at 11:34 PM 0
Share

yes, it works perfectly, as far as i can tell

avatar image 3dDude · Aug 14, 2010 at 12:02 AM 0
Share

hhhhhmmmmmmm i would try just comparing the finished version and the one you working on..... cuz theres got to be a problem somewhere ;)

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

No one has followed this question yet.

Related Questions

ufps package freezes when adding inventory system 0 Answers

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

using c# for fps tutorial 2 Answers

When my button is pressed the action reapeats 1 Answer

Change player control to a target model (FPS) 0 Answers


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