[Bug Report] Item Manager not adding all scripts to pick up prefab [solved]

#1
Using the item manager to create a first person melee weapon pickup prefab is not adding First Person Melee Weapon Properties script in the built prefab. It is also not adding the box collider. No errors/notifications from the console.

Using Unity 2018.3.0f2
 

Justin

Administrator
Staff member
#2
Can you list the exact steps to reproduce? I just tried to reproduce it but the FirstPersonMeleeWeaponProperties were added.
 
#3
1.JPG
1. Add the item type

2.JPG
2. Set new item type capacity to 1


3.JPG
3. Add the item for first person pickup, disabling third person

4.JPG
4. Add the object for pickup

5.JPG
6.JPG
5. This is the created prefab for the item from Item Manager

7.JPG
6. Here is the Pickup object created from Object manager

Maybe I'm missing a step? I've watched the videos several times on Run-time pickup, item types, and adding 1st person items, and can't see that I'm doing anything wrong.
 

Justin

Administrator
Staff member
#4
Thank you - the difference was that I had the first person base object set whereas you don't have it being added :) To fix this open ItemBuilder.cs and change the first if statement within AddMeleeWeaponProperties from:

Code:
            if (firstPersonObject != null) {
to:
Code:
            if (firstPersonObject != null || firstPersonVisibleItem != null) {
It looks like I need to do something similar with the grenade and shield.
 

Justin

Administrator
Staff member
#6
Sort of related to this, but I am going through this manager again and am trying to come up with a use case for specifying a First Person Visible Object but no base object. Do your character's arms and weapon model all exist within the same object? And you are using a unique set of arms for each weapon, similar to UFPS 1? In this case you should be using the base object field and not the visible item field. I'm thinking about hiding the visible item field unless a base object is specified.
 
#7
I might be doing a lot of things wrong, as i still consider myself a novice with Unity. However I will try to explain how I have stuff set up as best I can.

I originally created a self aware 1st person character using the character manager, after which I created an item using the item manager to get the first person arms. Thats the only time I specified a base object being first person arms. Every item i have created since then has been by the steps from the screen shot above. Third person arms are parented to Nolan, and items go in the item object created within Nolan and the hand ID (0 or 1) of the third person arms. I am not using unique arms for each item. So far everything seems to be working as expected, with some small issues I'm trying to figure out for myself (jump attack not in initially working but I'm sure I can figure that out by looking into the demo scene further).

I hope this helps, let me know what other information you need and I'll do my best to get it to you.
 

Justin

Administrator
Staff member
#8
When you create a new first person item (such as the barbarian sword in the screenshot above), what does the Renderer/Object field specify on the First Person Perspective Item component for your sword item (under Character/Items)? It sounds like it is using the first person arms, but it wasn't specified in your screenshot so I'm confused how it is working :)
 
#9
There is no object specified initially.

I have two different prefabs required to pickup an item and assign it to my fps arms.

first is the weapon item prefab itself, as seen here (BarbarianSword2H):
barbsword.JPG
This is the item that will be equipped to the fps arms

And the second prefab here (BarbarianSword2H_Pickup) is the item i place somewhere in the world. When the character collides with it, it equips the item specified to any object that has an ItemSlot ID of 0 (based on ItemSlot.cs)
barbswordpickup.JPG

Here is the branch where the item is attached once its picked up:
heiarchy.JPG
 

Justin

Administrator
Staff member
#10
Thanks - I'm actually surprised that that worked ;) Just to be sure I would assign the Render/Object field to the Nolan First Person Arms object and I'll hide the visible field unless a base object is specified.
 
#11
Everything seems to work fine as it is, and as intended based on the real time pickup video. If we assign the first person arms as the base object in the item manager, won't that conflict with how real time pickups work? Eg- real time pickup items might have arms attached to them or other unforeseen conflicts.

As it stands right now, I believe Object/render gets assigned the first person arms as soon as the player walks over the item. The screenshots I provided are from my project assets and are not yet placed in the scene.
 

Justin

Administrator
Staff member
#12
That's how it is working! It does look like you are using the runtime pickup code, but since you have added the item to your character it would then be doing a bit of extra work to find the object. If the character field is specified within the Item Manager then you should always have a base object defined.
 
Top