Integration of the inventory course

How to integrate the inventory system from the course . In a first person and third person controller

Solved.

I am a little unsure what you are asking here.
The inventory course is a stand alone module that builds onto our RPG core combat course which is based on a top down isometric view.
From this aspect you would just change the camera view.

The issue you might have is the input you are using as the way we would implement is to use the already implemented raycast for movement to detect if we are clicking on a pickup.
As long as your first and third person game use a similar raycast to shoot a gun i dont see why you wouldnt be able to implement this in any game at all.

Hope this helps and answers your query

1 Like

The problem , is that I’m not using raycasting for the gun. I’m using a sphere cast for the melee weapons.
And the problem I had when I added the model to the game exactly. The UI was unclickable .
The pickup was also not working . Tried changing it to collider based pickup that too was an issue .

Ok!

Marc, I am Kaushal and could you give me the link of Unity development coourse?

With the UI i am not too sure what the issue could be on that as i’ve not 100% completed the inventory course as yet.
The reason pick ups wouldnt work though is because its designed for raycasting to detect a click input.
Without seeing how you convert it then it would be hard to tell why its not working for a collision based pick up as it should convert okay

I’ll try to get some attention to this in the discord server as due to weather issues our RPG TA is experiencing power outtages until thursday.

@kaushal_vetsa This is an intermediate course and not the ideal place to start.
If you click at the top of the page where it says courses you will find our entire catalogue of courses there, If you prefer you can look for them on udemy as well.

Thanks

Alright, I will wait. But do you have any idea , how I can convert from a camera. Screen point. To a raycast from let’s say , a transform on the character.

I integrated the inventory system with my game and its a FPS game, for the pickups in the course sam adds a clickable pickup script and as you said add a collision check that’s what I did on trigger there would be a method called PickupItem or something just call that. For the UI I’m not too sure, as in my game its working fine, I did that when my player presses E the UI pops up and I freeze the controls for movement and looking and set the cursor’s lockstate to confined and it was working fine with no issues.

2 Likes

Can you please give me , an example script?. I would be grateful

I think in a 1st person, most of the Raycasting is unneccessary. There should be a ClickablePickup script (if it’s not in the package, let me know and I’ll post it here, there’s not much to it). As long as your player is tagged with Player, it should communicate just fine. Your character just needs to run over the pickup.

Can you describe what was happening with when you used a collider based pickup?

In terms of the UI not being clickable, most FPS games put the Mouse in a locked state, you’ll need to unlock the mouse when the inventory panel is up, and lock it again when you resume play.
https://docs.unity3d.com/ScriptReference/Cursor-lockState.html

I used ontriggerEnter and . On the UI, I don’t remember turning off the mouse cursor. When the inventory is turned off, since the melee system doesn’t need any raycasting , it just uses a sphere cast on a blade.
But when I call the inventory, the mouse doesn’t seem to click anything and the UI becomes unstable and flickers .

Do you have an EventSystem in your scene? It’s found in the GameObject menu under UI/EventSystem.

Yes it had an event system already in the scene. From the other UI elements such as health and sickness

Which is my next question… Do you have an invisible image in your UI that you briefly turn the alpha on to indicate you’ve been hit (very common in FPS games)?

Yes I have status effects. To indicate bleeding, bone breaking and poisoning to mention , just a few

Try turning unchecking the RaycastTarget in each of these elements.

That doesn’t seem to work. Still not giving option to click on the inventory UI. When brought up

Actually… clicking isn’t even part of it, the stuff we implement is all drag and drop between the panes… When you mouseover an inventory slot with an inventory item in it, do you get a tooltip?

That’s what I mean when I say clickable,. On hover doesn’t take effect or drag and dropping. I don’t get any response from it. Using the mouse.
I just took it and added it , didn’t make any changes to the inventory script.

Privacy & Terms