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 /
avatar image
0
Question by mewtwodan8 · Jul 14, 2019 at 03:19 PM · uiinteractionreferencesrpg-game

Button is Interactable but not interacting

Hi people, Working on an RPG battle system, trying to make something with real-time timers like FF7. I have a player component and an enemy component. When player's timer hits 0, their action button is interactable to set them as active so a target can be chosen from the enemies. A central component then turns all enemy buttons to interactable. The enemy button, however, is not interacting, the box is checked in the editor and i can see it go from low alpha to opaque, but it doesn't click or highlight. My event system is present and it is specifically this button that is not working, i tried remaking it but to no avail, i also tried switching the on click method, but nothing. The console isn't giving me any errors so i come to the community. Thanks in advance.

Here's my code, i don't know if it will help:

 public void Activate()
     {
 // this runs for the player and works fine
         Debug.Log(gameObject.name + " is active!");
         ActionButton.interactable = false;
         Game.SetActiveHero(this);
     }

  public void SetActiveHero(PlayerBattleControlV2_0 elected)
     {
 //this works too on the central game manager
         activeHero = elected;
         foreach (PlayerBattleControlV2_0 hero in heroes)
         {
             if (hero != activeHero)
             {
                 hero.SwitchSuspend();
             }
 
         }
         Debug.Log("Enemy Buttons activated");
         ToggleEnemyButtons();
     }

  public void ToggleEnemyButtons()
     {
 //this toggles all the enemy (only 1 for now) buttons and works
         foreach (EnemyBattleControlV2_0 enemy in enemies)
         {
             enemy.ToggleButton();
         }
     }

 public void ToggleButton()
     {
 // this is where things go weird, the box is checked but i cant use the button
         targetButton.interactable = !targetButton.interactable;
     }

 public void beTargetted()
     {
 // this is what is meant to happen when the button is pressed
         Debug.Log(gameObject.name + " is targetted");
         Game.SetActiveTarget(this);
     }




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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by k234234w · Jul 14, 2019 at 04:30 PM

Does your canvas have a graphics raycaster, without that component on your canvas you wont be able to click on anything. Can you raycast when you click and print off all ui elements you hit, it could be something is invisible that is absorbing the click. Have you tried always having your buttons interactable, that would be a good thing to check to help isolate the problem.

Comment
Add comment · Show 3 · 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
avatar image mewtwodan8 · Jul 14, 2019 at 07:07 PM 0
Share

O$$anonymous$$G thank you so much, the neighbouring text i had for the health,cooldown and mana bars all had raycast target checked, unchecking that fixed my problem. Is there any use in that being checked if i'm not going to be clicking them?

avatar image k234234w mewtwodan8 · Jul 15, 2019 at 01:28 AM 0
Share

If they are not being interacted with they should have raycast target off. I think its actually more performant to turn raycast target off on objects that do not need it.

avatar image mewtwodan8 · Jul 14, 2019 at 07:09 PM 0
Share

how do i reward u as the answerer

avatar image
0

Answer by marcel0321 · Oct 15, 2019 at 12:30 AM

In the idle state, the button's front plate is not visible. As a finger ... Interactable handles various types of interaction states and events. HoloLens ... This code is working nice. Thanks for sharing...... Official IMO for Windows

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

186 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 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 do I close in the distance between the player and object to pick up? 0 Answers

2 canvases working weird with buttons 0 Answers

How I create game for pc and get inventory for an app on my cell phone? 0 Answers

UI mouse click prevent default / stop propagation. (Block mouse events of other scripts) 3 Answers

GearVR Button.One UI interaction 0 Answers


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