Cannot set Weapon Spawn rotation/position. UCC + UIS

As the title states, I cannot set the spawn position and rotation of my weapons. Every weapon I have (four in total ATM) will spawn exactly the same. With the "Z" axis (local position/rotation) pointing straight up to the sky. This presents an issue as I'm using the Third Person Controller and the weapons must have their local Z axis pointing in the Look Direction to fire accurately. The only thing that works is the scale, the scale of the object will always stay to what I set it as. The position and rotation always get reset and the Rotation always end up being one of these two (180, 180, 180) or (0, 360, 0) in the transform of the prefab object.

I've tried the following: - just to mention, I position the weapons when in play mode just as in the videos/docs. Then copy the values to the prefabs at edit time.

1. Change the orientation of the prefab child objects. This will not work as the parent object that gets spawned on the player will always point Local Z up to the sky, so no matter the orientation of the child objects ( rotating them to face forward even though the parent is facing up) the weapon still will not fire.

2. Setting the position and rotation of the Prefab object itself (so the main/parent object transform).

3. Setting the "Local spawn" position and rotation in the "Third Person Perspective" script.

4. Reworking the prefabs due to the pivot point being far away. (maybe 5-10 unity units @ scale)

Anyways, only the scale saves and the position/rotation just reset to what I mentioned above.

As a side note, I noticed all of my prefabs "Pivot" point ends up far away from the actual object center/transform 0, 0, 0 point. This is consistent with all of the weapons prefabs. They were all created using the item manager as the integration video describes. I just have to remove the parent object from the prefab and put another empty game object as the parent and it fixes it. Not sure if it's my models or the manager. Easy fix to that one though.
 
You should be setting the spawn position using method 3. As a way to debug this if you place a breakpoint within PerspectiveItem.Initialize does the localPosition/Rotation get set? If it does, are you able to tell us how to reproduce the issue within a fresh project?
 
I tried placing break points in the Initialize function of the "Third Person Perspective Item" script. I tried placing a breakpoint on every line in the function but nothing changed or did anything. (I've never used break points before so I could have done it wrong).

I remade a weapon from fresh with the UCC item manager and then created inventory definitions for it and it was working at first. I had the visual (equipment) prefab in the equip prefab field when it was working but then it started giving me errors about the prefab attributes and I had to change them around. Using the fully made weapon as both visual prefab and useable prefab. Then tried to switch them back and now I'm just in the same position.

Could it be something with the UCC shootable weapon set of scripts? The four scripts that get added when making an item. Other than that I'm not sure what else to try. I have limited time.
 
So I looked into breakpoints and debugging in VS and from what I'm gathering since it didn't hit the break point then it didn't run the function containing the breakpoint?

But now I've added some debug lines of my own, just using Print("Initialize running"); and it most definitely is running the initialize function and the local spawn/rotation function so I guess it's something wrong with how I have my prefabs set up.
 
Last edited:
You setup a runtime item, correct?

The ShootableWeapon component doesn't position the item. If you can tell us how to reproduce the problem from a fresh project we can take a look.
 
Sorry, not the shootable weapon component itself. When you make a run time pick up and you choose the "Shootable Weapon" type of item from the selection list it adds those four scripts to the item to make it a run time pick up. I was trying to find out if the problem is within one of those scripts.

And yes I am making all of the items run time pick ups. I'll try making a bunch of fresh new prefabs and see how they work.
 
Did you get it to work? I have the same issues, I follow the step in the tutorial and it don't work.. always spawns the same way
 
Did you get it to work? I have the same issues, I follow the step in the tutorial and it don't work.. always spawns the same way
Yes I ended up figuring out exactly what was happening. I guess I should've updated the thread so here we go.

I had to eventually just look at the PlayerCharacter gameobject at run time and see which item was actually parented to his Hand(the item slot) and which items were parented to the "Items" object on the PlayerCharacter.

I found that when you create a runtime prefab through the Object Manager (through the character controller manager (not the inventory manager)) it uses the Main Prefab Object (parent) as the "Reference" item. So this is the one with the four main weapon/item scripts, shootable weapon, perspective properties etc... This gets parented to the "Items" object on your player character

Then the object that gets parented to the players hand, the "Visual" item, is the direct child of that Main prefab object. This is the object that gets positioned and used for the actual game item. This will most likely have your animator and "Animator monitor" scripts if you added an animator when creating it.

So in your "Third person perspective" script on your main item you will have to put in the values for local pos/rot. But you have to scale the child item itself.

You can also scale the "Hand" object or whatever object that "visual" item gets parented to on your playercharacter but this will change the scale for every item so be careful.
 
Yeah I got it working. Thanks! I'm not using UIS yet but I will soon, creating a runtime grenade pickup is tricky, how is it done ?
 
I think they usually want separate threads for separate questions. There are a few on grenades I know for sure, since I've had issues and posted haha.

But anyways, grenades can be tricky because you need to know the difference between the "Grenade" object and the "Throwable" object. The grenade object is just the object that the player will hold in their hand while idle (if it is equipped) or throwing.

The "Throwable" is the object that gets tossed through the air as your playercharacter throws the "Grenade".

So for me I just had to realize that I needed to make a "Throwable" that is the grenade I want to be thrown, on top of making the "Grenade" prefab.

Also there seems to be some weird issue with scaling when using grenades. Just figure out which object you need to scale to have it look proper.
 
Top