Ok guys - so I almost ripped my own head off looking at the ref manual trying to figure out how to do something that would have been rather small but fundamental…
That is referencing a value from another script. I have my pathfinding in one script, and my animations in another. The main reason I’m doing this is to expose myself to learning in regards to referencing effectively rather then just lumping it all into one script or doing retarded calls per frame to check a value.
The float speed I have set up is in the pathfinding script - on the same object. The animation script I reference under
Not the actual code - closed out Unity already but I’ve been looking at this little script for a bit so memory should do.
AnimationScript.cs
private float isMoving;
Start()
//DAAMMMMNNNN YOOOUUU.
Path path = GetComponent<Path>();
isMoving = path.speed;
Update()
if isMoving >= 3
animate
else stop animation
Now… it won’t stop animating. I can understand why (maybe - I’ve only been learning coding for 7 months or so). I still have a lot to learn and try to keep my head in the refs rather then copy and pasting codes because ya’ aint gonna learn crap doin’ that.
So here is where I need help.
Is this valid logic on my part? That since I’m only checking the path.speed once on start, it will stay a static value? (path.speed is not a static, it is a public float in path.cs) but static in the sense to animation.cs because it will NEVER check it again?
Its gotta be bad performance to have it checking in even Fixed - so is there a way to for me to send a message TO animation rather then calling from it if speed is over say 3? That seems the more logical way.
I’m going to sleep either way and gonna sleep on it but man guys I just had one of them days where something so simple makes ya’ wanna pull your own hair out…