Announcement

Collapse
No announcement yet.

Scope bug? Variable is none unexpectedly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scope bug? Variable is none unexpectedly

    I have a variable called HUDManager in my blueprint. While handling the Event Tick event, this variable seems to be accessible. However, when handling the Left Mouse Button Pressed event, the HUDManager variable appears to be set to 'None'.

    There is only one instance of this blueprint in my scene, so as far as I can tell this should be the same scope, same variable, same instance of the blueprint.

    I've attached a picture of my blueprint. There are two active breakpoints. When breaking on the 'Branch' node, HUDManager is defined. When breaking on the 'Print String' node, HUDManager is None.

    Any theories are appreciated, thank you


    Click image for larger version

Name:	hudmanager.png
Views:	1
Size:	191.5 KB
ID:	1135932

    #2
    Not sure if it will fix it, but try this... it's also good for your performance.

    Make a variable of type HUDManager.

    Set it on begin play event.

    Right now you are requesting it and typecasting it on every frame... not very performance friendly.

    It could possibly also fix your problem. Why it is not working as it is right now I can't figure out.
    Easy weapons in Unreal Engine 4:
    Check out Realistic Blueprint Weapons

    Currently doing a tutorial series on Vectors and what they are good for.
    Please visit Unreal Unscripted

    Comment


      #3
      Hey thanks for your advice, you're absolutely right. The HUDManager variable is of type 'Actor' for no good reason at all.

      I feel like if I was coding, I wouldn't have done it that way at all... this blueprint stuff messes with my head.

      (I'll have to try this when I get home, but honestly don't think it will actually solve the issue)
      Last edited by shawkes; 06-16-2014, 03:31 PM.

      Comment

      Working...
      X