• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
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

avatar image
0
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
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
0
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();
         }
     }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

45 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to play animations from script. 0 Answers

Animation rigging doesnt work until I disable and re-enable Rig Builder 0 Answers

Swapping characters breaks controls 0 Answers

How to instantiate a game object every time when space key is pressed 2 Answers

Help with OnTriggerEnter Not working correctly? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges