Having a problem here while trying to create an effect for enemies to fall over after death, the Unity error says:
CS1061 'Transform' does not contain a definition for 'LocalEulerAngles' and no accessible extension method 'LocalEulerAngles' accepting a first argument of type 'Transform' could be found (Are you missing a using directive or an assembly reference?)
Here is a piece of my code under,
public class ShootingEnemy : Enemy
protected override void OnKill () {
base.OnKill ();
agent.enabled = false;
this.enabled = false;
transform.LocalEulerAngles = new Vector3 (10, transform.LocalEulerAngles.y, transform.LocalEulerAngles.z);
Which is connected to my Enemy script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
public int health = 50;
public int damage = 5;
void OnTriggerEnter (Collider otherCollider) {
if (otherCollider.GetComponent<bullet>() != null) {
Bullet bullet = otherCollider.GetComponent<bullet> ();
if (bullet.ShotByPlayer == true) {
health -= bullet.damage;
bullet.gameObject.SetActive (false);
if (health <= 0) {
OnKill ();
}
}
}
}
protected virtual void OnKill () { }
}
I am not very familiar with LocalEulerAngles and am pretty new to programming so I can't pin point the problem. If you need more of my ShootingEnemy : Enemy script let me know and if you know what the problem is that would be much appreciated.
Unity error message states it on this line with all three LocalEulerAngles
transform.LocalEulerAngles = new Vector3 (10, transform.LocalEulerAngles.y, transform.LocalEulerAngles.z);
What I have tried:
I have looked for fixes for CS1061 error but none have helped with my situation.