Flashlight UI

MissBig

Member
Hi, I have set up a flashlight and the UI but it doesn't seem to work. I have copied the demo for this and even dragged my Attribute Manager to the flashlight UI but it doesn't come up on the screen at all. Is there a step by step guide or a tutorial that may be added. Everything else works. Even the light comes on as well but I just can't work that UI out.
 
If you copied the FlashlightBattery GameObject from the demo scene there is a state under the AttributeMonitor which only enables the monitor when the Flashlight state is active. If you want it to be visible all of the time you can remove that state and enable Visible under the AttributeMonitor.
 
If you copied the FlashlightBattery GameObject from the demo scene there is a state under the AttributeMonitor which only enables the monitor when the Flashlight state is active. If you want it to be visible all of the time you can remove that state and enable Visible under the AttributeMonitor.

No the UI for flashlight doesn't show at all even if I have visible checked. It just doesn't show the flashlight slider.
 
I worked out the problem even though I put the flashlight item attribute Manager in the slot on the UI in-game is changing it to the player attribute and I don't know how to fix it.
 

Attachments

  • AttributeMonitor.PNG
    AttributeMonitor.PNG
    22.7 KB · Views: 12
  • FlashlightItem.PNG
    FlashlightItem.PNG
    44.5 KB · Views: 13
  • Ingame.PNG
    Ingame.PNG
    20.7 KB · Views: 14
I worked out the problem even though I put the flashlight item attribute Manager in the slot on the UI in-game is changing it to the player attribute and I don't know how to fix it.

I've tried everything and nothing works. The players attribute always gets spawned in the slot regardless. I even tried in the new scene with a quick setup of the flashlight but the same thing still happens.
 
One way to debug this would be to place a breakpoint/Debug.Log within AttributeMonitor.CanShowUI and see why it is returning false. I just did a test where I duplicated the GameObject within the demo scene and made sure to enable Visible and remove the Flashlight attribute. When I did this it showed all of the time.
 
One way to debug this would be to place a breakpoint/Debug.Log within AttributeMonitor.CanShowUI and see why it is returning false. I just did a test where I duplicated the GameObject within the demo scene and made sure to enable Visible and remove the Flashlight attribute. When I did this it showed all of the time.

I tried it in a completely different scene that has nothing except for the controller and it still does not work at all. It's still doing the same thing so try it from scratch rather than duplicating it. I did it from scratch.
 
If you duplicate the Flashlight battery UI in the demo scene it works but when you do a scene from scratch and even if you use Nolan it does not work at all. The character attribute Manager goes into the place where the flashlight attribute is already there. I tried both ways and I have been trying this all day but it does not work. And yes the demo 1 does work so I have no idea how to fix this. I don't script at all.
 
I tried to build new characters in the demo scene but it is still doing the same thing so I think the problem might be is when your things from scratch.
 
Thanks - I see what went wrong. You can fix this by changing AttributeMonitor.OnAttachCharacter from:

Code:
if (m_AttributeManager != null) {

to:
Code:
if (m_AttributeManager != null && m_AttributeManager.gameObject == character) {
 
Thanks - I see what went wrong. You can fix this by changing AttributeMonitor.OnAttachCharacter from:

Code:
if (m_AttributeManager != null) {

to:
Code:
if (m_AttributeManager != null && m_AttributeManager.gameObject == character) {

Thank you, Justin, it has completely worked now. Thanks for all your help this is still a great asset.
 
Top