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 Casey28xxx · May 07, 2013 at 08:28 PM · noobcompatibility

Particle effect instantiate problem.

 //Enemy Script
 
 //Inspector variables
 var numberOfClicks : int =2; //no of times you click to destroy object
 var respawnWaitTime : float =2.0;
 var shapeColour :Color[]; //colour array
 var explosion :Transform; //loads the particle effect
 var enemyPoints : int =1; // value of enemy destroyed
 
 //Private variables
 private var storeClicks : int =0;
 
 function start()
 {
     storeClicks = numberOfClicks;
 }
 
 function Update ()
 {
     if(numberOfClicks <=0)
     {
         if(explosion)
         {
             Instantiate (explosion, transform.position, transform.rotation); //create an explosion
         }
         var position = Vector3 (Random.Range(-6,6),Random.Range(-4,4),0); //new random position for game objects
         RespawnWaitTime ();
         transform.position = position; //move game object to new position
         numberOfClicks =storeClicks;
         }
     }
 // will be used to hide and then unhide a GO for a random amount of time
 function RespawnWaitTime ()
 {
     renderer.enabled =false;
     RandomColour();
     yield WaitForSeconds (respawnWaitTime);
     renderer.enabled =true;
 }
 // random colour is used to change the colour of enemy GO in game
 function RandomColour ()
 {
     if(shapeColour.length >0)
     {
     var newColour = Random.Range(0,shapeColour.length);
     renderer.material.color =shapeColour[newColour];
     }
 }

Been following the Walker Boys tutorial for a basic clicking game, everything seemed to be going smoothly until I got to adding lines of code for creating a scoring system. Could this be an issue with using unity 4 and the tutorials being 2 years old? Or is it just me and my lack of understanding?

Any help appreciated as always.

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 Casey28xxx · May 08, 2013 at 12:44 AM 0
Share
 SOLVED!
 
     //Private variables
     private var storeClicks : int =2;
 
 
 
 
 I changed this to 2 even though in the tutorial video it's set to 0! Yet still gives the same result of working??
 
 I'm still convinced something is wrong here and would love to get to the bottom of it.

1 Reply

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

Answer by Casey28xxx · May 13, 2013 at 11:45 PM

Sorted.

Grammar as usual "function Start" instead of "function start"!

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

12 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

Related Questions

Noob question - why isn't my emissive surfacce working? 2 Answers

Unity 5 Networking Help 0 Answers

How to set up a cave in Unity ? 2 Answers

Enemy won't damage player C# 1 Answer

Help fixing a bug with camera script 2 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