So I had some trouble getting some things to work and got fairly good answers over at this post.
The only issue I had occured when trying to translate the C# code that the gentleman provided into Javascript. I now get the error stated in the title. I’m assuiming it’s because Player is not a valid object. But my player prefab, once spawned gets a UNIQUE name from ALL other players with the SAME prefab. So i cannot just replace Player with the name of the prefab since they all have a unqiue one. I hope I could get some help solving the follwing issue,
function OnCollisionEnter(collision : Collision)
{
if (canattack)
{
if (other.gameObject.CompareTag("Player"));
{
if(col.collider.other.GetComponent("Player"))
{
var otherPlayer : Player = col.collider.other.GetComponent("Player");
if(otherPlayer.isBlocking)
{
this.Stun ();
}
else
{
otherPlayer.Damage(damage);
}
for (var contact: ContactPoint in collision.contacts)
{
var impact = Instantiate(impactPrefab, contact.point, Quaternion.FromToRotation(Vector3.up,contact.normal));
collision.gameObject.SendMessage ("Damage", damage,SendMessageOptions.DontRequireReceiver);
}
}
}
}
}
just to clarify, this is on a script named Player, in a class named Player and you do not have a C# Player script currently, correct?
– Alec-SlaydenWhy not just use the standard shader and set the emission channel? With a bloom effect on your camera (and HDR enabled) you should see them glow.
– tanoshimi