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 Cold_Ankles · Aug 30, 2012 at 01:36 PM · instantiateuce0001semicolon

Assets/Scripts/scriptEnemy.js(24,35): UCE0001: ';' expected. Insert a semicolon at the end.

Doing a Basic Unity Tutorial I came across the issue of the particle system not having a autodelete any more. I found a solution which is throwing up the error. Here is my code:

 //Enemy Script
 
 //Inspector Variables
 var numberOfClicks         : int = 2;
 var respawnWaitTime     : float = 2.0;
 var shapeColour            : Color[];
 var explosion            : Transform;
 //Private Variables
 private var storeClicks    :int = 0;
 
 //Called once
 function Start(){
 
     storeClicks = numberOfClicks;
 
 }
 
 //Called every frame
 function Update(){
 
     if(numberOfClicks <= 0){
         
         if(explosion){
             GameObject newexplosion = (GameObject) Instantiate(explosion,transform.position,transform.rotation);
             Destroy(newexplosion,3);
         }
         
         var position = Vector3(Random.Range(-5,5),Random.Range(-5,5),12);
         RespawnWaitTime();
         transform.position = position;
         numberOfClicks = storeClicks;
         
     }
     
 }
 //Used to hide the game object for a set amount of time, and then unhide it.
 function RespawnWaitTime(){
 
     renderer.enabled = false;
     RandomColour();
     yield WaitForSeconds (respawnWaitTime);
     renderer.enabled = true;
     
 }
 
 //Changes the colour of the material of the game object
 function RandomColour(){
     
     if(shapeColour.Length > 0){
         var newColour = Random.Range(0,shapeColour.Length);
         renderer.material.color = shapeColour[newColour];
     }
 }

I await your useful assistance.

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

3 Replies

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

Answer by Piflik · Aug 30, 2012 at 01:40 PM

That is a UnityScript code, but line 24 is C# (or looks like to me).

This:

 GameObject newexplosion = (GameObject) Instantiate(explosion,transform.position,transform.rotation);

Should be:

 var newexplosion : GameObject = Instantiate(explosion,transform.position,transform.rotation);
Comment
Add comment · Show 2 · 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 Cold_Ankles · Aug 31, 2012 at 10:37 AM 0
Share

You've solved one problem but now there's another: Assets/Scripts/scriptEnemy.js(24,68): BCE0022: Cannot convert 'UnityEngine.Transform' to 'UnityEngine.GameObject'.

avatar image Piflik · Aug 31, 2012 at 11:04 AM 0
Share

The declaration of 'explosion' has to be a gameobject ins$$anonymous$$d of a transform.

 var explosion : GameObject;
avatar image
0

Answer by Asad Chaudhry · Dec 10, 2012 at 09:31 PM

I know its a very late reply. Since i came across the same problem whilst working on the same tutorial . Here is how i solved it .

//Inspector Variables

var explosion : Transform ;

And then in the update function

         var t : Transform = Instantiate(explosion,transform.position,transform.rotation);
         
         var newExplosion : GameObject = t.transform.gameObject;
         
         Destroy(newExplosion,2);
         
         
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 foresiite13 · Mar 05, 2013 at 10:52 PM

Hi guys I'm having a similar issue in myHealthControl.J's script. The affeced line: var healthBar: GameObject.HealthBarGUI.FindWithTag("HealthBarGUI");

Tht console says it is expecting ';'. Insert semicolon at the end. But I already have. Any help is greatly appreciated.

Also. On a side note, I am a Modeler and concept artist by nature so this coding system is foreign to me. I am willing to barter assets for scrip and script based components. Email me if interested: foresiite@gmail.com Thanks guys!

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

10 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

Related Questions

What am I missing? I already have the semicolon at the end.. 1 Answer

UCE0001: ';' expected. Insert a semicolon at the end. 1 Answer

';' Expected, Tried everything. How do I do this? 1 Answer

Checking if object intersects? 1 Answer

UCE0001 ";" expected. insert a semicolan at the end? 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