Forum rules - please read before posting.

Best way to make 2D collectables?

Hi everyone,
I'm making a game where you can pick up a constant supply of collectables (think spyro gems or sonic rings), but I'm looking for the best way to implement this. I have a 2D trigger over the prefab, a sound plays and the variable goes up and the object disappears. But I need A LOT of them in the map (say like 100 or more), obviously I don't think it's good practice to make 100 prefabs to be able to remove each one.

I'd assume making 1 prefab disappear/removed via actionlist would make all the others in scene disappear too since they are the same constant ID.

Does anyone have any ideas?
Thanks! :)

Comments

  • Create an ActionList asset to handle the Trigger's Actions (removing the object, adding to the inventory, etc), and then set your Trigger's Source to Asset File to have it trigger the ActionList instead of its own Actions.

    Then, in the ActionList asset, create a new GameObject parameter, and use it to override the Object: Add or remove Action's Object to remove field. That way, you can dynamically set which object is removed at the time the list is run.

    Finally, attach a Set Trigger Parameters component to your Trigger, and use it to assign itself as this parameter's value.

    More on prefabbing logic can be learned in this tutorial, while more on working with parameters can be found here.

  • Thanks so much Chris! :smiley:

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.