Not sure if this is the right place to put this… But anyways, Hey everyone, I wrote a script to change strings and buttons based on user input on a virtual keyboard. Everything seems to be working how I was it to, however, now that I have this code, I’m not sure how to implement it… I’ll post my code and see if anyone can help! Thank you!
EDIT: Oops, I wasn’t clear of what I wanted to do with this! I’m getting all of my string values so that I can change keyboard input during runtime.
2220472–147801–Inputs.cs (3.16 KB)
2220472–147802–InputManager.cs (1.48 KB)
2220472–147803–KeyboardUI.cs (3.74 KB)
Not sure what you mean. Everything is working however you’re not sure how to implement it?
At any rate, some things look a bit off at first glance.
InputManager seems to be your consumer class, while Inputs, KeyboardUI are consumed. That would be fine but your consumed classes are also MonoBehaviours with their own Awake() methods and so on, while the consumer holds the Update() logic.
For this pattern to work right it seems to me you should keep the consumer class as the only MonoBehaviour, with Update() and Awake() methods and so on… and leave the consumed classes as just that.
Otherwise, you’ll have to attach all of these scripts to GameObject(s) and set up proper references, either by referencing the GameObjects the scripts are attached to, or use static properties but that’s probably not what you want.
I actually do have them attached to GOs so I can update my lists I have, but you don’t think that’s a good idea?
I’m trying to change input at runtime, but unsure how to use what I have in these scripts to change moving forward, backward, etc.
You can certainly go about it in many different ways so I won’t say you can’t try a pattern if it’s working but in general I would refer to the pattern I described above as the usual workflow. But, you say it’s not working, so…
I think you have to do some old fashioned debugging at this point and just see if you get the scripts communicating as you intend to and work backwards from testing simple things like that.
The code is very spaghetti-like and has no comments so its tough to look at it all and figure out exactly what is going on.
You’re probably going to hate me… But it is working, I’m just not sure how to use this as an input to make the player move… Does that make sense? I can finish commenting and reupload later tonight though! (: