Ideas for execution needed

Hey guyz. I am still banging my head against the wall, that my simple game appeared to be.
Now, i have done some things, and they are working great... ok, they are working. Polish needed..
I need to basically add one small thing, and i will upload finally the "Just Do It" challenge result. I know, i am late, and i am late a lot...
Now, my question is: How to make resource gathering? Unity 5...
I do not want to do it on collision, as from what i know, collision is the most resource intensive way.
So what i imagine in my head is may be ray casting? And if the character is in harvestable distance, button prompt appears, and i am able to harvest the resource. That should mean, that every harvestable object in the game need to reycast... And that could tank the game to Xbox 360 framerates...
But if i want to raycast from the character, then how am i suppose to check for only harvestable objects? I mean coding for so many types of fruits and shrooms etc will be kind of painful...
So i need some ideas on how exactly to do harvesting in a game without using collision.
Unity 5...
Thank you in advance :)
PS: I have properly working database and inventory, etc... I just need basic ideas and advises on how to harvest mushrooms with button press while i am for example 1 meter away, but hot further.

Get someone to pick the mushrooms for you? IDK how else to make picking things up in a game an original concept.

I don't want to make it original concept... I want to code it :D But i don't know how. And every tutorial i find is about FPS and slashing with swords and platformers, and i don't know how to execute a stupid popup icon if you are in certain range of an object...
And i am struggling with raycasting at the moment...

Object oriented programming, in c# you can easely implement inheritence.


Actually i will use one raycast from the camera position to the mouse cursor... If the ray hits an object, that could be harvested, i will just check the distance, between it and the player character and if it is close enough - start harvesting...
There will be only one raycast and only one calculation for distance.
I just need some time to do this, since my daily job is a bit of an issue for me at the moment.

What i basically need to do is unlearn Game Maker... I have messed around with it for 3-4 years now, and moving from GM 8 to Unity 3D is quite stressing, since 80% of the things, i need to program in GM are default functions in Unity and there are way easier ways to complete tasks in Unity without having to code everything.

You can check out the progress in this topic:
My Game Project
I update it every time there is something new...

Found a solution for all the different items?

What do you mean by inheritance? I think i know what you mean, but i rather ask and listen to people, that know more than me, then assume i know and end up not knowing...


Class item (
Bla some item specifc things.

Class mug : item (
Some mug or subclass specific stuff.
Probalby getter and setter.

: is the syntax for inheritance in c. And c#
Extends is it in java

Inheritance also means that the subclass can use code of the parent class.
And it also becomes a dynamic object of the parent and its own class.

Mor or less like that.

OK, you just intrigued me...
I know the basics of parent/child objects... The way you are explaining this to me, it sounds similar to Game Maker Parent / Child relationship...
Now the thing that throws me off is this "mug" thing...
I use C#. Don't really care about Java.

I know, but in both languages the childs can use parent code/methods depending on how you set them up.

The main point is that the object of the class mug is a object of the item class too.

So instead of checking for a list or having a hughe switch or some other structure like that.

You can either check for their parent or call a method that every object contains / inherits to do the inventory farming stuff

Something like. This.pickUp()

Or so

1 Like

OK, now i got what you mean...
Basically it was what i was thinking.
What i am going to use in the actual game is just a stupid code something like
if(distance item-player < 2 or whatever){
turn the object's visuals and colider off
whatever resource ++
you are to far away
I am going simple, since this is my first kind of serious project... It's nice to know i have this tool in my belt.

How about


The pickup method could contain different code depending on the object.

If you have a simple one its just. Resource++
And with more complex ones its a more complex method

The actual code that starts the picking up is simple, Independent, and works for every object.
The object basically picks itself up

That's exactly what I'm doing.
The action is mouse click, the pick up is just adding one to the inventory and not rendering the object...