Create a script called ObjectSpawner.cs that can be attached to any game object with a RectTransform component.
Class
Object Spawner |
- RectTransform rectTransform;
- [serializable] List<Prefab> objects;
- [serializable] List<int> objectWeights;
- [serializable] float spawnInterval; //How often to try to spawn in seconds
- [serializable] float spawnCount; //How many to spawn every interval
- [serializable] float spawnChance; //Chance of spawn being successful per interval
- [serializable] float startDelay; //How long to wait until fist spawn
- [serializable] float lifeSpan; //How long to until spawner is becomes inactive or destroyed.
- [serializable] float maxSpawns; //How many spawns until spawner is becomes inactive or destroyed.
- void Update() {
//Handle random selection fo objets based on their weights on the members values.
}
|
Comments
Sup Joe,
I am working on the format of these tasks and the comments so dont be surprised if you have trouble edditing what I have above. If you have you TP email set up you should get an email from this comment since I made you the author of the above task. Take a look at the basic footprint I detailed above and let me know what you think,
Editing should all work pretty nice now! I swear I'll stop working on the website any second now. I did do some Unity dev while I waited for Star Wars to start!
Add new comment