I don’t know what I did wrong I tried couple different ways from not using commands to using SpawnWithClientAuthority
. But It either gives build and compile errors or just the Error in the title
Here the Start function of my player object
void Start () {
player = isLocalPlayer;
race = Data.races[(int)selectRace].getInstance();
clss = Data.classes[(int)selectClass].getInstance();
health = race.Health * clss.HealthMultiplyer;
speed = race.Speed * clss.SpeedMultiplyer;
armor = race.Armor * clss.ArmorhMultiplayer;
energy = race.Energy * clss.EnergyMultiplayer;
skills.AddRange(race.RaceSkills);
skills.AddRange(clss.ClassSkills);
Data.entities.Add(this);
Debug.Log(isLocalPlayer);
if (!isLocalPlayer)
return;
int enID = Data.entities.IndexOf(this);
foreach (Skill s in skills)
s.CmdSpawn(enID);
}
And here is the spawn functions from skills I try to spawn
[Command]
public override void CmdSpawn(int enID)
{
setEntity(Data.entities[enID]);
Debug.Log("Spawned");
dir = getEntity().lookingAt;
gameObject.transform.position = getEntity().transform.position + dir * 0.65f;
transform.up = dir;
NetworkServer.Spawn(gameObject);
}
and
[Command]
public override void CmdSpawn(int enID)
{
setEntity(Data.entities[enID]);
dir = getEntity().lookingAt;
transform.up = dir;
dir = new Vector3(dir.z, dir.y, -dir.x);
gameObject.transform.position = getEntity().transform.position + dir * 0.65f;
NetworkServer.Spawn(gameObject);
}
If you can help, thank you ^.^