Announcement

Collapse
No announcement yet.

Variable not in Scope.....

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

    Variable not in Scope.....

    See the attached image. What I've got going on here is a "Football" Blueprint trying to communicate with the My Character Blueprint. All I want to do is have my "Player has Ball" variable (from the "My Character" blueprint) accessible and changeable inside of the "Football" blueprint. However, I keep getting "variable is not in scope" messages and I don't understand why. What can I do to fix this?


    Click image for larger version

Name:	Variable_Not_in_Scope.jpg
Views:	1
Size:	280.7 KB
ID:	1140427

    #2
    It's not in scope to the debugger or you get this issue when trying to use it?

    Comment


      #3
      Hello,
      drag a "cast to" your character from your "character" variable and you'll can access your "Player has ball" variable.

      Comment


        #4
        You shouldn't have to do that because it's a variable of your character class, so you shouldn't need to cast.

        This is actually an issue with Blueprints, any variables you access inside a function always appear as 'Not In Scope'. There are two ways around it, you can make a collapsed graph of the nodes, or you can just have it in your main blueprint until you know it works, then collapse it to a function. Strange how this hasn't been looked into yet actually, though I'm not sure if it's a bug or a limitation.

        Comment


          #5
          It doesn't seem to matter if I use the above method (in the screenshot I provided) OR if I do a "cast to my character." In both cases, I get this "variable not in scope" message and stuff doesn't execute as desired because of that issue.

          Comment


            #6
            In your other thread ErWilly pointed the fact that maybe your character variable maybe the trouble. If you made a generic player instead of your specific one, or if for some reason you did changes and they were not updated and that you need to delete / create / add again to have it working, it maybe the issue of your two troubles.

            Comment


              #7
              Hi VagrantProfile,

              If you feel this may be a bug in the editor, please make an answerhub post at http://answers.unrealengine.com in the bug reports section. In this, please make sure to include any reproduction steps you may have so that we can reproduce it on our end.
              Adam Davis | Marketplace Support | Epic Games
              How to report a bug? | Installation & Setup issues? | Answerhub Bug Reports | Twitter

              Comment


                #8
                Here's a question: As you can see from my screenshot above, my "MyCharacter" variable is associated with my "MyCharacter" blueprint (the one that comes by default with the 3rd Person template). HOWEVER, this variable itself is referenced DIRECTLY by a copy of the "MyCharacter" Blueprint I placed in my level (see pic below)> I did this because I do no know how to reference the character I SPAWN IN AS. Could this be the problem?

                Click image for larger version

Name:	Football_Blueprint.jpg
Views:	2
Size:	114.7 KB
ID:	1060695

                Comment

                Working...
                X