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 Beciri · Jun 29, 2015 at 06:08 AM · instantiateunexpected-symbol

Help Please-Unexpected symbol `Instantiate

I wanted to make bulletholes and raycast,but this error is annoying,somebody help please im new on this,about 4 days. thanks :)alt text

alt text

desktop-29-6-2015-2-08-53-529.png (447.9 kB)
desktop-29-6-2015-2-07-34-168.png (14.7 kB)
Comment
Add comment · Show 1
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 Beciri · Jun 29, 2015 at 12:37 PM 0
Share
 using UnityEngine;
 using System.Collections;
 
 public class shoot : $$anonymous$$onoBehaviour {
 
     public GameObject bullet;
     public GameObject bulletHole;
     public float delaytime = 8;
 
     private float counter = 0;
 
     // Use this for initialization
     void Start () {
 
     }
     
     // Update is called once per frame
     void FixedUpdate () 
     {
          if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.$$anonymous$$ouse0) && counter > delaytime)
          {
             Instantiate(bullet, transform.position, transform.rotation);
             GetComponent<AudioSource>().Play();
             counter = 0;
 
             RaycastHit hit;
             Ray ray = new Ray(transform.position, Transform.forward);
             if(Physics_Raycast(ray, out hit,100f)            
 
                Instantiate(bulletHole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal);
             
           }
           counter  += Time.deltaTime; 
     }
 }

3 Replies

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

Answer by Mouton · Jun 29, 2015 at 12:50 PM

You are missing a closing parenthesis at line 29

There is also an error with Physics_Raycast which should be Physics.Raycast

 if (Physics.Raycast(ray, out hit, 100f))

Whenever you got an unexpected symbol error, look for the missing (or spare), symbol.

As stated by @tanoshimi, you should format your code properly next time.

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 tanoshimi · Jun 29, 2015 at 06:11 AM

When asking for help, please:

  • Format your code properly. Don't screenshot your code.

  • Include the full error message. It would tell us exactly where the error is.

In your case, however, the problem is apparent... I suggest you count how many brackets there are on line 28.

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 GiyomuGames · Jun 29, 2015 at 06:18 AM

Try removing the empty line 29 and/or put brackets around your Instantiate code line 30.

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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to make object instantiate once but still call next function. 1 Answer

2D repeating obstacles with a random Y value 0 Answers

Need help moving player object towards an instantiated ball 1 Answer

How can I destroy an specific clone already instantiated, when there's more than one? 1 Answer

Destroying assets is not permitted to avoid data loss. If you really want to remove an asset use DestroyImmediate (theObject, true); UnityEngine.Object:Destroy(Object) Gun:Update() (at Assets/Scripts/Gun.cs:75) 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