Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

Joystick DPad axis to bool

$
0
0
Hello, I want to have a class in the inspector to debug those variables. I have problems on the get/set method in the declarisation section. Is there a way on how to set them at runtime without using in Update, just in the declarisation section? [System.Serializable] public class DPad { public bool left { get { return this; } set { Input.GetAxisRaw("DPAD_X") < 0; } } public bool right { get { return this; } set { Input.GetAxisRaw("DPAD_X") > 0; } } public bool up { get { return this; } set { Input.GetAxisRaw("DPAD_Y") > 0; } } public bool down { get { return this; } set { Input.GetAxisRaw("DPAD_Y") < 0; } } } [SerializeField] public DPad dpad; void Start() { ... } This gives me an *Only assignment, call, increment, decrement, and new object expressions can be used as a statement* error.

Viewing all articles
Browse latest Browse all 215

Trending Articles



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