Hello, i’m havnig troubles with sending a command from player’s top object down to the gun object in his hands.
So the hierarchy of the player prefab is this:
ROOT (With PlayerControl script) --SkeletonRoot ----Hips ------<...> --------Wrist ----------Guns ------------Gun1 ------------Gun2 ------------Gun3
Currently I implemented shooting through the Weapon script attaches to a gun. So I can have different weapons doing different things, and I won’t need to adjust the player’s top object. For example I plan to have a simple shooting gun, a gravity gun, a particle gun, etcetc, all doing different things.
So the Weapon script of the Gun currently tracks player’s input, particularly RMB for aim and LMB for shooting, it also runs the appropriate animation of the player object for this particular gun.
So, just saying, trying to making it somehow modular. And yes, I’m not an experienced programmed, so it can be a wrong approach in it’s core, of course.
But the particular problem I have is this:
I’m trying to use UNet to network this. And right now I can’t call [RPC] function from the weapon. And I can’t assing Authority of it to the player, because it is a part of player prefab which is required to have only one NetworkIdentity script on it.
I tried calling [Command] from the PlayerControl script, to track player’s input only there, but that did not work either. Because to call a command from object it has to be Network Identity too.
So the problem is - How do I call a Shoot command from a child object of the Player??
Thanks in advance.