- Home /
How Can I Make Collectable Objects?
I would like to make some collectible objects for my video game. If you have ever played Assassin's Creed Revelations you will know that you can collect data fragments. I would like to make that sort of thing in my game with around 100 objects hidden around my world and when you collide with them they disappear and (For instance) it says "1 out of 100 skulls collected". I would also like it if when you collect all the collectibles, you unlock a special mission or something. Can you help me please? That would be great!!!
Don't take this rudely, but what level are you at? In both your coding and game? Half of me wants to help for future readers and half of me wants this closed for being to ambiguous/vague. Think about what you have already said :
with around 100 objects hidden around my world
when you collide with them they disappear
it says "1 out of 100 skulls collected"
when you collect all the collectibles, you unlock a special mission or something
You have already described the steps to achieve this.
have a builtin array, drop your 'skulls' in the inspector
each collider has a script that (1) disables the gameObject and/or (2) adds to some counter
(1) read how many objects are disabled in the array or (2) read some counter
if some counter > 20, unlock1 = true;
Answer by Democre · Nov 20, 2012 at 04:55 PM
I think you've identified how you want to do it, just do it in steps.
I would like to make that sort of thing in my game with around 100 objects
Make an array of collectables in a manager class or just a counter, depending on your needs
and when you collide with them they disappear
Make a behaviour script that destroys the game object in OnCollisionEnter or OnTriggerEnter and then attach that to a prefab.
and (For instance) it says "1 out of 100 skulls collected"
In the above collision behaviour script also send a message to or call a method on your manager (the one with the array) and either change your data array or bump the counter. Then display a message from the manager.
I would also like it if when you collect all the collectibles, you unlock a special mission or something.
In the manager script, when it receives an updated count, check the necessary requirements for a mission or something and if those are met, unlock it.
If you need help with specific scripts, post the code you have and describe how it has failed to meet your expectations, and we can try to help you out. We won't write your code for you for free. If you want your code written for you, post in the commercial or collab forums.
Pretty much the same as my comment :/
But may as well leave it, it has more description which will help future readers. The OP really need to modify or remove this question.
That's fine, leave it posted. Am also half frustrated at the question.
Your answer
Follow this Question
Related Questions
How do I keep objects destroyed between scenes? 1 Answer
destroy object after a delay? 6 Answers
CCG: Creating a card object 2 Answers
Customizing/Morphing Player instantiated object 2 Answers
Extending a class 1 Answer