Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

An instance of type 'UnityEngine.Behaviour' is required to access non static member 'enabled'.

$
0
0
Hi, I got the error in the title when I tried to disable a Animation component. All I need to know is how to put ' UnityEngine.Behaviours ' into my script. Here's My Code: var MuzzelFlashGo : GameObject; var NoAnimationGO : GameObject; function Start () { Animation = gameObject.GetComponent("Animation"); Animation.enabled = false; } function Update () { if(Input.GetButtonDown("Fire1")) { var gunsound : AudioSource = GetComponent.(); gunsound.Play(); MuzzelFlashGo.SetActive(true); MuzzelFlashStop(); GetComponent.().Play("GunShot"); GlobalAmmo.LoadedAmmo -= 1; } if (Input.GetButtonDown("Fire1")) { if (GlobalAmmo.LoadedAmmo < 0) { GlobalAmmo.LoadedAmmo += 1; } if (Input.GetButtonDown("Fire1")){ if (GlobalAmmo.LoadedAmmo < 0) NoAnimation(); } } } function MuzzelFlashStop() { yield WaitForSeconds (0.1); MuzzelFlashGo.SetActive(false); } function NoAnimation() { Animation.enabled = false; } All I need to know is how to put 'UnityEngine.Behaviours' into my script.

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>