Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by cre8or · Apr 22, 2016 at 04:08 AM · c#scripting problemscripting beginnerevent triggering

Question about triggering an event (Extremely Novice to Programming)

I have a wee game that I've got working, as far as the interactivity goes. But, in my lack of foresight, I need to add a couple instructional panels.

What I have is this: I have an animator that controls the OPEN and CLOSED states for 3 different UI panels. When the scene is launched, the animator slides the first UI panel in from the left. This animator is controlled by a ScreenManager.cs script attached to an Empty Game Object, I've called ScreenManager.

I have another script called ShopliftingInteractivity.cs that dictates what happens when the user interacts with the different elements of the UI.

What I want is this: At the point that the animator has shown the first panel, but before the user stars tapping things all willy-nilly, I'd like to Set.Active an overlay panel that serves as an instruction screen. I would like to call this Instructional screen from my ShopliftingInteractivity.cs script, to keep the ScreenManager.cs only dealing with showing the UI panels.

For the life of me, I cannot figure out the magical incantation that will allow me to do this.

I've tried:

 public Animator AmateurCrimeboard;
 
     public void ShowInstructionPanelOne ()
     {
         if (Animator AmateurCrimeboard.isInitialized)
         {
             InstructionPanelOne.SetActive (true);
         }
     }

I've also tried:

     public void ShowInstructionPanelOne ()
     {
         if (Animator AmateurCrimeboard.isActiveAndEnabled)
         {
             InstructionPanelOne.SetActive (true);
         }
     }


I've also tried:

     public void ShowInstructionPanelOne ()
     {
         if (AmateurCrimeboard==true)
         {
             InstructionPanelOne.SetActive (true);
         }
     }

The thing is, I don't quite understand all the language in the manual, so I don't really know what it is that I'm looking for. I am also not a programmer, I am a graphic designer who is really trying to learn. I believe I'm close, but I'm not using the correct syntax.

I would appreciate help from someone more knowledgeable than myself. Thank you kindly, in advance.

@Mavina

Comment
Add comment · Show 1
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
avatar image Soraphis · Apr 22, 2016 at 05:03 PM 0
Share

with animation events: http://docs.unity3d.com/$$anonymous$$anual/animeditor-AnimationEvents.html

you can call methods at a specific time-position in your event. e.g. at the end of a animation

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by cre8or · Apr 22, 2016 at 03:22 PM

Okay, I believe I have solved my problem. It may not be the most eloquent solution, but it does seem to work:

 // waits for two seconds before calling the ShowInstructionPanelOne function
     void Awake()
     {
         Invoke ("ShowInstructionPanelOne", 2);
     }
 
 //Shows the Instruction Panel only if the AmateurUI is active in the scene
     void ShowInstructionPanelOne()
     {
         if (AmateurUI.activeSelf)
             InstructionPanelOne.SetActive (true);
     }

The Amateur UI is on a canvas that also contains two other UIs and is controlled by an animator to slide each in/out based on user interaction. I wanted the first instruction screen to be an overlay on top of the UIs, so the instruction screens (3 of them) are on another Canvas, with the order set to 1. After a delay of 2 seconds, the InstructionPanelOne is displayed onto of the AmateurUI with the instructions. Once the user had read the instructions, they can dismiss this panel and continue on.

Like I said, it may not be beautiful, but it does work.

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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

149 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 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 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 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

Player not moving in the right direction instantly 1 Answer

Issue toggling Particle system on/off using bool. 1 Answer

Adding a Highscore to game 1 Answer

Keeping Score out of Update Function 1 Answer

Error CS0122: inaccessable due to protection level 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges