This question was
closed Dec 24, 2015 at 09:19 PM by
KnightRiderGuy for the following reason:
The question is answered, right answer was accepted
Question by
KnightRiderGuy · Dec 24, 2015 at 06:15 PM ·
c#scripting problemanimationsaccessing from any script
Access Animation From Another Script
I'm trying to activate an animation on another script but I'm clearly missing the correct way of doing it. This is the part of my script I'm trying to call the animation in.
void DirectionArrow(int Direction)
{
if (Direction == 8) {
//Activate Left Direction Arrow Indicator
GetComponent<SystemGuidanceManagerScript>().LEDlightsW.GetComponent<Animator>();
}
if (Direction == 9) {
//Activate Right Direction Arrow Indicator
}
}
Comment
Best Answer
Answer by KnightRiderGuy · Dec 24, 2015 at 09:18 PM
I just love answering my own questions :/
As it turns out after much mucking about I needed to do this:
void DirectionArrow(int Direction)
{
if (Direction == 8) {
//Activate Left Direction Arrow Indicator
SystemGuidanceManagerScript sgms = FindObjectOfType<SystemGuidanceManagerScript>();
sgms.WestArrow();
sgms.EastArrowOff();
}
if (Direction == 9) {
//Activate Right Direction Arrow Indicator
SystemGuidanceManagerScript sgms = FindObjectOfType<SystemGuidanceManagerScript>();
sgms.EastArrow();
sgms.WestArrowOff();
}
}
Follow this Question
Related Questions
Animation rigging doesnt work until I disable and re-enable Rig Builder 2 Answers
How to play animations from script. 0 Answers
I want my script to wait 2 seconds before continue in a condition, in update, using C# 2 Answers
error CS0120: An object reference is required to access non-static member 1 Answer
Touch Force on 3D Object 2 Answers