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 RickHurd · May 12, 2013 at 06:42 PM · functionparticlesystemshootfirebce0005

BCE0005: Unknown identifier: 'Fire'. / Secondary shot?

I'm not sure why I am getting this error...

Im trying to shoot using a particle system, but for some reason im getting this error

BCE0005: Unknown identifier: 'Fire'.

 var particleSystem : ParticleSystem;
   
 function Update ()
 {
 if(Input.GetButtonDown("Fire1")){
 Fire();
 }
 }

I also am trying to figure out how to add a second fire function to my script once i get past this dumb error, This is what I was thinking (below) but I cant even test it cuz of the error.

 var particleSystem1 : ParticleSystem;
 var particleSystem2 : ParticleSystem;
   
 function Update ()
 {
 if(Input.GetButtonDown("Fire1")){
 Fire(particleSystem1);
 }
 
 if(Input.GetButtonDown("Fire2")){
 Fire(particleSystem2);
 }
 
 }


Is that in the right direction?

Comment
Add comment · Show 4
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 DaveA · May 12, 2013 at 06:43 PM 0
Share

Where is your Fire function?

avatar image RickHurd · May 12, 2013 at 08:20 PM 0
Share

Do i have to do

function Fire(){

????

avatar image Graham-Dunnett ♦♦ · May 12, 2013 at 09:05 PM 0
Share

Yes, you'll need to write some code for that.

avatar image RickHurd · May 13, 2013 at 01:07 AM 0
Share

Oops :P

Well the thing is, i'm using a particle system so does it need rigid body? I just want the laser to bounce off of a wall. Will I need rigid body on the laser to do damage to the player or something?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Negagames · May 12, 2013 at 10:22 PM

You never made a function that pertains to "Fire".

 function Fire(particleSystem prtcl){
      Instantiate(prtcl, transform.position, Quaternion.identity);
 }

If I understand what you're trying to accomplish, there is much more that you need here such as a rigidbody or a collider.

Comment
Add comment · Show 5 · 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 RickHurd · May 12, 2013 at 11:03 PM 0
Share

I'm trying to shoot a Laser (particleSystem) and have it bounce off of walls but hurt the player if it contacts the player.

That last function you gave me does not work, how would I write a script to shoot particle1 with left mouse click and particle2 with right mouse click, as well as hurt "Player.tag" but bounce off of "Wall.tag"

avatar image Negagames · May 13, 2013 at 10:25 PM 0
Share

Put the script here, and are you sure you used the code I wrote correctly?

avatar image RickHurd · May 13, 2013 at 11:51 PM 0
Share
 var particleSystem1 : ParticleSystem;
   
 function Update ()
 {
 if(Input.GetButtonDown("Fire1")){
 function Fire(particleSystem1 prtcl){
      Instantiate(prtcl, transform.position, Quaternion.identity);
 }
 

I got 4 errors (7,10): BCE0044: expecting (, found 'Fire'. (7,31): BCE0044: expecting ), found 'prtcl'. (7,36): BCE0043: Unexpected token: ). (8,65): BCE0044: expecting :, found ';'.

avatar image RickHurd · May 18, 2013 at 11:29 PM 0
Share

Im still stuck on this one.... I dont know how to write a Particle Shooting script...

avatar image AlucardJay · May 19, 2013 at 01:12 AM 0
Share

@RickHurd , There is a saying : "One must learn to crawl before they can walk". I feel you don't understand the basic concepts of program$$anonymous$$g. You should really be spending your time learning to program with lots of $$anonymous$$i projects before you attempt your 'big' project idea. You should be spending your time doing one of the gabazillion tutorials out there. Try this one : http://www.unityjumpstart.com/ProofOfConcept_1/

Do i have to do function Fire(){ ?

Yes, you'll need to write some code for that.

Oops :P Well the thing is, i'm using a particle system so does it need rigid body?

This chain of comments makes no sense.

Then your above code example is just a mess. You cannot put a function inside a function.

 function Start()
 {
     // I am a Function
 }
 
 function Update()
 {
     // I am also a Function
     
     // Now I'm going to call another function called Fire
     Fire();
 }
 
 function Fire()
 {
     // I am also a Function
     // I am being called by the command Fire();
 }

Again, I strongly suggest you start small, then work up. Here is a playlist I strongly recommend to all new users : http://www.youtube.com/watch?v=-oXYHNSmTxg&list=PL27B696FB515608D2&feature=plcp


@Negagames , the code in your answer is not correct. It seems to be a hybrid of C# and uJS. Also you missed a capitol in your typecasting of ParticleSystem.

 function Fire( prtcl : ParticleSystem )
 {
     Instantiate( prtcl, transform.position, Quaternion.identity );
 }

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

18 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

My gun won't fire. ( Javascript ) 1 Answer

Hold Button Shooting 3 Answers

Firing System with two Shoot Points 1 Answer

Fire outline shader 1 Answer

how do i stop automatic firing? 3 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