Using Transform Component and selfmade interface in an Network Command ?
Hello there !
I want to use a custom interface and a Transform Component in my network command ... but the error says this : "UNetWeaver error: Command function [WeaponUtilites:Cmd_hit] cannot have abstract parameters"
Here some pieces of my code :
public class FireControll : NetworkingBehavior, Hitinterface
void fire() {
if (fireTimer < fireRate || currentBullets <= 0 || isReloading) return;
// Calls the command
weaponUtilites.Cmd_hit(this, shootPoint, range);
}
public void onHit(RaycastHit hit)
{
GameObject bulletHole = WeaponUtilites.spawnImpactHole(impactHoles, hit);
WeaponUtilites.spawnParticleEffect(hitParticles, hit);
HealthController.isDamageable(hit, damage, bulletHole);
}
}
//--------------------------------------------------------------------------------------------//
public class WeaponUtilites : NetworkBehaviour{
[Command]
public void Cmd_hit(HitInterface hitInterace, Transform shootPoint, float range) {
RaycastHit hit;
if (Physics.Raycast(shootPoint.position, shootPoint.transform.forward, out hit, range)) {
// Calling the interface method !
hitInterace.onHit(hit);
}
}
}
//--------------------------------------------------------------------------------------------//
public interface HitInterface
{
void onHit(RaycastHit hit);
}
So i personally thought this is the way to do this... until i noticed that it isnt working because im using abstact parameters... Command methods only accept float int and bool.... Is there an other way to get Command methods working with a custom interface and a Transform Component ?
Your answer
Follow this Question
Related Questions
ClientRPC not called from command on client instance during Start() 0 Answers
Designing a multiplayer lobby for LAN 1 Answer
Making different users see their data on the same canvas 0 Answers
UNET Clients Laggy 0 Answers
Photon RPC 2 Answers