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 Herve_Simard · Mar 02, 2012 at 06:40 PM · spawntimer

Spawn fixed number of enemies on fixed spawn points using a fixed delay

As my title said:

I'm trying to spawn a fixed number of ennemies, forming a wave of enemies. There will be five points from which they will be able to spawn. I'd like them to choose a random point from which to start, then spawn one after another until they are all there. The delay will be fixed as well, about 3 or 4 secondes.

Do I need a script? Is there any tutorial available? Any help?

Thanks!

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 poncho · Mar 02, 2012 at 09:08 PM

yes, you need a script, using unity without scripting is almoust impossible for this you will need - an array of your spawn positions - a method to be invoked every 3 or 4 seconds - instantiating your enemy at one of your spawn positions

for the tutorials i would recommend how to programm for dummies to learn the basic concept about programming then you could use google and unity script reference to anything yo want to do with unity

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 Herve_Simard · Mar 03, 2012 at 03:22 PM

Not bad, I'll try this, that's a good way to start. As for programming, don't worry, it might be okay. Thanks! I'll give an update if I do anything good.

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 Herve_Simard · Mar 06, 2012 at 02:33 PM 0
Share

Finally got something, thanks for the tip!

avatar image
0

Answer by Herve_Simard · Mar 04, 2012 at 07:37 PM

I'd like to know now how to link an array of spawnpositions into an instantiate...

I've tried this:

public class SpawnScript : MonoBehaviour { public int NumberEnemies;

 public float SpawnTimer;
 
 public float SpawnCountdown = 240.0f;
 
 private Transform[] SpawnPoints;
 private Transform[] Enemy;
 private bool canSpawn = false;
 
 void Start()
 {
     
 }

 void SpawnEnemy()
 {    
     // Mettre un index en paramètre de mes tableaux.
     Instantiate(Enemy[0], SpawnPoints[0], Quaternion.identity);
     NumberEnemies += 1;
     SpawnTimer = 0.0f;
 }
 
 void Update () 
 {
     while(NumberEnemies != 7)
     {
         SpawnTimer = 0.0f;
         SpawnTimer += Time.deltaTime;
         
         if(SpawnTimer >= SpawnCountdown)
         {
             SpawnEnemy();
         }
     }
 }
 }

But it keeps on giving me this kind of error:

Assets/Scripts/SpawnScript.cs(24,17): error CS1502: The best overloaded method match for `UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)' has some invalid arguments

And I've yet to figure why it's happening...

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Timer Spawn Freezing Unity C# 1 Answer

Timer to call Instantiate 1 Answer

Timer with 5-6 rounds that spawns enemies then end game 0 Answers

Random spawn timer 1 Answer

Make enemies spawn faster with timer? (C#) 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