Evening or Morning.
I am trying to pass the weapon owners name to a projectile?
I am able to get the weapon owners name but when i try to pass it to the projectile, the projectile owners name is the name passed...
to get weapon owners name:
`owner = gameObject.transform.root.name;`
Trying to pass it to projectile with:
`if (projectile != null)
{
Projectile newProjectile = Instantiate(projectile, muzzle[i].position, muzzle[i].rotation) as Projectile;
newProjectile.SetSpeed(muzzleVelocity);
newProjectile.SetDamage(damage);
newProjectile.SetOwner(owner); // this line here to pass
}`
projectile script:
`public void SetOwner(string ownerName)
{
ownersName = ownerName;
}`
ownersName always comes back as weapon name in projectile script.,
↧