Good news! To provide faster support and grow the community, we'll be changing the forum to "Read Only" and turn to Discord instead for support.
Join here: https://discord.gg/zjNj5zZ

I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

spcmicro
Posts: 3
Joined: Mon Aug 28, 2017 8:22 am

I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

Postby spcmicro » Mon Aug 28, 2017 8:28 am

I have a scavenger game for children that challenges them to find objects beginning with different letters. I want them to click on an object to "Find" it, have it added to their inventory of found objects, leave the object in the scene and not allow the player to find the object again. This means leaving the object in the scene when it has been "Found". I think I know how to disable the trigger but I'm not sure how to tell inventory pro to add an object to an inventory without removing it from the scene.

Can this be accomplished in Inventory Pro?

nathanj
Posts: 223
Joined: Sun Sep 25, 2016 5:38 am

Re: I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

Postby nathanj » Mon Aug 28, 2017 10:37 am

You could have two objects: one, your IP item (an invisible trigger); and, two, the scene object. You could add the two objects to a parent and make a prefab of that.

The consumed trigger will be destroyed while the scene object remains, untouched.

User avatar
PeterBibinin
Posts: 194
Joined: Mon Oct 24, 2016 10:55 pm
Location: Poland
Contact:

Re: I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

Postby PeterBibinin » Mon Aug 28, 2017 5:19 pm

Or add function public void NotifyItemPickedUp()

And add in this function Instantiate function and set Vector3 and Quaternions same to this.transform, this.rotation

You can also create new item type with this function above and add in inspector public game object witch will be copy of item without IP scripts. And use this copy to Instantiate object on scene
Waiting for sunrise
-------------------------------------------
Try make world beter ;]

My Advanced Save System tutorial with screen capture like in The Forest !
Advanced Save System
-------------------------------------------
BAZINGA !

nathanj
Posts: 223
Joined: Sun Sep 25, 2016 5:38 am

Re: I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

Postby nathanj » Tue Aug 29, 2017 9:05 am

Nice one, Peter

I'm totally gonna use that from now on :)

Clean up my hierarchy some!

spcmicro
Posts: 3
Joined: Mon Aug 28, 2017 8:22 am

Re: I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

Postby spcmicro » Tue Aug 29, 2017 9:30 am

I like Peter's solution because it doesn't Involve creating 2 of each object at design time. This could get expensive, memory wise, as some of the objects in question are large models. Using Peter's solution there will only ever be one of each object in the scene.

User avatar
PeterBibinin
Posts: 194
Joined: Mon Oct 24, 2016 10:55 pm
Location: Poland
Contact:

Re: I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

Postby PeterBibinin » Tue Aug 29, 2017 12:42 pm

I have more solutions but other is more conventional methods :)

But this methode take information from static objects no dynamic I think better for performance.

I write how this work. There is on scene static object (for bake light) and this object have script with public uint itemID; and private bool itemTaken =false;

Player also have script who raycast and if player push button F and target will be this object, script execute get component from this object if itemTaken =false script add item to inventory and set bool to true.

Now object is set to true and no one can't pickup item again.

But like I said. This is conventional methode :)
Waiting for sunrise
-------------------------------------------
Try make world beter ;]

My Advanced Save System tutorial with screen capture like in The Forest !
Advanced Save System
-------------------------------------------
BAZINGA !

spcmicro
Posts: 3
Joined: Mon Aug 28, 2017 8:22 am

Re: I need the ability to find objects, add them to an inventory but NOT remove them from the scene.

Postby spcmicro » Tue Aug 29, 2017 1:08 pm

I like Peter's second suggestion even better. No extra objects required.
Thank you Peter...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 3 guests