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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by scarfey91 · Oct 23, 2012 at 01:12 PM · errorbullet

bullet problem

ok so this is my complete script on main object that has a spawnPoint for the bullet to spawn from t he bulletprefab is tagged and the bullet itself it fine

this also causes my unity to crash from time to time

the script is forming the bullet but the bullet isnt going anywhere and im getting this error

"Missing Field Expection: field unity engine. transform.tag not found" boo.lang.runtime.dynamicdispatching.propertydispatcherfactory.findextension (error line 15)

 var speed : int = 5;
 var rotateSpeed : int = 3;
 static var bullets : int = 10;
 var timer :float;
 var bulletPrefab : Transform;
 
 
 function Start () {
 
  while(true){
        while(!Input.GetButtonDown("Jump"))yield;
  
       
           bullet = Instantiate(bulletPrefab, GameObject.Find("spawnPoint").transform.position, transform.rotation);
           bullet.Tag = "bulletPrefab";
           bullet.rigidbody.AddForce(bullet.forward *400);
 
        }
 }
 
 
 
 
 function Update () {
        
        var controller : CharacterController = GetComponent(CharacterController);
        transform.Rotate(0, Input.GetAxis ("Horizontal") *rotateSpeed, 0);
        var forward = transform.TransformDirection(Vector3.forward);
        var curSpeed = speed * Input.GetAxis("Vertical");
        controller.SimpleMove(forward * curSpeed);
       
            
             
 }    
     
           
     
     
 function OnGUI(){
       
       GUI.Label(Rect(10,10,200,50), "Timer:" + timer);         
       GUI.Label(Rect(10,30,200,50), "Bullets left:" + bullets);
       
 }
 
Comment
Add comment · Show 5
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 Landern · Oct 23, 2012 at 01:24 PM 0
Share

So like...you know... whats the error message?

avatar image scarfey91 · Oct 23, 2012 at 01:30 PM 0
Share

umm i think it was that it cant fine the tag bulletPrefab
but i cnt check that as it keep crashing everytime i press space

avatar image Landern · Oct 23, 2012 at 01:34 PM 0
Share

make a stand alone of your game, go and run it, check the data folder for output_log.txt, see if it contains the error in there. You can also comment out some of the lines of code starting from the bottom when you addforce, try and narrow down the problem. You setting the tag shouldn't be an issue, what script is trying to find the tag? is it happening when the bullet collides with something? You don't give much information as to the use case for your single function you posted.

Does it crash right when you hit space bar? does the bullet actually move on the screen?

avatar image Sooper1337 · Oct 23, 2012 at 01:46 PM 0
Share

You could try using an if statement in the update function, that might stop your unity from crashing.

like this:

 function Update () {
     if(Input.GetButtonDown("Jump")){
     
         bullet = Instantiate(bulletPrefab, GameObject.Find("spawnPoint").transform.position, transform.rotation);
         bullet.tag = "bulletPrefab";
         bullet.rigidbody.AddForce(bullet.forward *400);
     }
 }
avatar image scarfey91 · Oct 23, 2012 at 01:52 PM 0
Share

im not sure why but its stopped crashing now which is helpful Landern i have also update everything with some more information

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Sooper1337 · Oct 23, 2012 at 05:41 PM

You could try using an if statement in the update function, that might stop your unity from crashing.

like this:

 function Update () {
     if(Input.GetButtonDown("Jump")){
     
         bullet = Instantiate(bulletPrefab, GameObject.Find("spawnPoint").transform.position, transform.rotation);
         bullet.tag = "bulletPrefab";
         bullet.rigidbody.AddForce(bullet.forward *400);
     }
 }
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 scarfey91 · Oct 23, 2012 at 06:12 PM 0
Share

ive stopped it crashing but i dnt know what this error is or how to stop it also my bullet isnt going any where its just still

$$anonymous$$issing Field Expection: field unity engine. transform.tag not found" boo.lang.runtime.dynamicdispatching.propertydispatcherfactory.findextension (error line 15)

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

11 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

Related Questions

Bullet Script 2 Answers

object referance problem with bullet adding 1 Answer

2D bullet script errors. 1 Answer

Instantiate bullet hit enemy aim error 0 Answers

The code is giving me errors 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