Create multiple virtual objects

Hi, i’m currently developping a simple tycoon game.

The main focus and loop of the game is creating objects.

For example. You create a car. We have a class named “car” which includes name of the car, power etc.
And I want player to input data through UI and store that data and then display it maybe even use it.

My question is. What is the best way to create multiple objects that player can create in-game and store them.

I’ve looking for the best possible solution for quite a while now and I would really appreciate your help.

Thank You in advance.

Bro did you find out how to do that? I will apreciateif you will share.

List / Array.

Btw. I requested move thread to
Game Design
But maybe is even more suitable in
Getting Started

2 Likes

Thats a question that is pretty specific to your specific game and overall setup. Im not sure you will get a lot of in depth help. In terms of storing stuff you can create a class to hold the info about the object, including what prefab represents the in-world object (3d model / sprite of object / icon etc) and then collect all of it in a collection such as a list or array, and then pull relevant info out when you need it such as for spawning, getting stats etc.

Thats very high level though, but it should all be relatively easy.

EDIT: this should get you started on similar concepts:

https://medium.com/@yonem9/create-an-unity-inventory-part-1-basic-data-model-3b54451e25ec

2 Likes

Yes i did :slight_smile:

https://www.youtube.com/watch?v=TAJCr3_kfEc