I have a basic sphere that I use as a planet and a widget attached with text. I would like to be able to copy paste the default multiple times with generic variables that I can change within the editor so I don’t have to create a new planet and widget for each one. As far as I have reached is:
A- when player ship enters collision the widget visibility binding will make visible (planet name, description and resources).
B- when player exits collision hide widget.
When I try to bind the text under content the visibility stops working. When I create a text variable reference the reference is accessing null? I tried to create an array to hold all variables so when player ship enters collision the planet will tell the widget which name,etc it needs to display. Ive tried to created the array text on both the planet and the player ship, again when collision happens the display should happen. However, communication between blueprints or variables are laughing at me. I attempted to set the planets as an object group - then get all actors of class - then tell it which planet it is - then just have a separate widget in place for each planet to print the text. But the widget visibility stops working.
I think an array is the most effective way to do this but I don’t know if the logic I’m using is right? How do I communicate array variables to widget text visibility?
You should have 1 widget and 1 table containing the data from all planets. Then you just need to tell the widget the planet’s name or id, for it to get the planet’s data from the table and display it.
I assume by table you mean an array? Or is that an actual chart. If you do mean chart I didn’t know you could do that in UE. So minus the chart, which I will have to research, what I should do is store all planet info on the player? Then when the player overlaps the player will be the one telling the widget what planet it is? I’m not sure what you mean would you mind giving more detail?
First you crate a Structure:
Then a Data Table:
Then a widget X, where giving a planet’s id, it reads the table and sets the info:
In your planet, you have a widget set to X. When the player enters the planet collision area:
Hi, ive been working on getting it to work with the help you have given me and I was unable to get it to work. Sadly my project crashed and I’ve done everything I can do get it back but I have failed. So I’ve started over with a new project file. It sucks but it’s all I can do. I’m a truck driver so I don’t get much time to work on my game. However when I get home I will take another crack at it. Thank you for your help.
Nothing happens when the player collide with the planet. I have a visibility binding set. No matter how I hook up nodes from image 4 to the overlap it will not execute pass casting to main HUD. The table info allowed name editing in the editor which is what I want. and I see how the structure and data table work well for what I want to achieve But again when the overlap happens no information from the table is displayed.
The print string does print what I have set in the editor upon overlap. If the visibility is on the two text widgets will only show the default words “text”. I do have the widget set to the HUD and dragged the added widget from the planet to be connected to get user widget object.
What I noticed is when I add a widget to the planet it does not appear in the view port. Also a message only appeared once saying somthing like trying to access name and description return null. Or access null. So I think my mistake is on the hud widget. Setting those variables and adding a text box to the widget canvas. Because I dont need to bind the text as I’m setting the visibility within the planet.