Relevant Code:
TestGun.cs
using UnityEngine;
using FishNet;
using FishNet.Connection;
using FishNet.Managing.Scened;
using FishNet.Object;
public class TestGun : Gun
{
public GameObject projectilePrefab; // Assign this in the Unity Editor
public override void InitializeSpec()
{
this.subtype = GameConstants.GunType.Pistol;
this.rarity = GameConstants.Rarity.Uncommon;
this.specName = "Test Gun";
this.baseDamage = 10;
this.attackSpeed = 20;
this.modelPath = "Weapons/Guns/SMG/SMG";
this.armorPen = 0.5f;
// Assets/Resources/Prefabs/TestProjectilePrefab.prefab
projectilePrefab = Resources.Load(TestProjectile.prefab_path) as GameObject;
}
public override void PerformMainFunction()
{
ServerPerformMainFunction(); // <----- line 29, errors here
}
[ServerRpc]
public void ServerPerformMainFunction()
{
RpcPerformMainFunction();
}
[ObserversRpc]
public void RpcPerformMainFunction()
{
GameObject projectileObject = Instantiate(projectilePrefab, transform.position, transform.rotation);
TestProjectile projectile = projectileObject.GetComponent<TestProjectile>();
projectile.Initialize(
position: transform.position,
rotation: transform.rotation,
damage: this.baseDamage,
speed: 10,
procChance: 10,
lifetime: 3,
parentEntity: this.parentEntity,
parentSpec: this
);
}
}