- Home /
Question by
UnityNoob123 · Jun 08, 2017 at 06:46 AM ·
networking
Unet Shooting, trying to send a command for object without authority?
I am making a unet game in which my player spawns projectiles, but when that happens I get the error "Trying to send a command without object authority". My player is set to local player authority and I will add my shooting script below, thanks for the help.
if (Input.GetButton ("Fire1") && canFireBall == true) {
LeftClick ();
}
[Client]
void LeftClick () {
CmdLeftClickEffect ();
canFireBall = false;
FireBallCoolDownTime = 0f;
fireBallIcon.fillAmount = 0f;
shotFireBall = true;
}
[Command]
void CmdLeftClickEffect () {
var _mainSpell = Instantiate (fireballSpell, projectileSpwan.transform.position, projectileSpwan.transform.rotation);
string thisPlayersID = gameObject.GetComponent<playerSetup> ().IDTag;
float _damage = this.gameObject.GetComponent<playerStats> ().DetermineDamageFireBall ();
_mainSpell.GetComponent<splashDamage>().setCastersId (thisPlayersID, _damage);
NetworkServer.Spawn (_mainSpell);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612123740im_/https://answers.unity.com/themes/thub/images/avi.jpg)