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

error CS0120: An object reference is required to access non-static member

$
0
0
I have a problem with the error CS0120 : An object reference is required to access non- static member , could someone help me with it?> Blockquote using UnityEngine; using System.Collections; public class PlayerBehaviour : MonoBehaviour { public Transform mesh; public float forceFly; private Animator animatorPlayer; private float currentTimeToAnim; private bool inAnim; // Use this for initialization void Start () { animatorPlayer = mesh.GetComponent (); } // Update is called once per frame void Update () { if (Input.GetMouseButtonDown (0)) { inAnim = true; Rigidbody2D.AddForce (new Vector2 (0, 1) * forceFly); } if(inAnim){ currentTimeToAnim += Time.deltaTime; if(currentTimeToAnim > 0.4f){ currentTimeToAnim = 0; inAnim = false; } } animatorPlayer.SetBool("callfly", inAnim); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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