Unreal - Creating Dynamic 3D Text

Unreal doesn't do well when using UI Widgets set to World View. The text is very pixelated and there isn't a clear solution that I have found. So, I resorted to creating a Blueprint actor and making my own with a text component. 

I needed to create a callout that toggles on/off on click as a child of a larger parent blueprint that contains a number of things - a highlight/trigger box, the mesh itself, an icon indicating it's an interactable object and the callout in question. This blueprint object - we'll call it a room component object - pulls it's information in from a datatable (ie. name, price, etc) via an id. So I have a function that initializes this parent blueprint - using it's id variable to look up it's row from the table and grab the info it needs for itself. 

At the end of this function I set the text on the callout blueprint to the retrieved 'name' info. Within the callout blueprint itself I have a function that sets the text content of the text component to this info.

I dragged out a reference to the callout blueprint, dragged a pin out to access this function, but ran into problems connecting by callout reference to the target pin. It gave me an error saying, 'child actor component object reference isn't compatible with BP_Callout'

I started to find the answer here - https://forums.unrealengine.com/t/using-child-actor-component-as-object-reference/141425 where I realized I need to cast it to the blueprint it's deriving from.

But it still gave me an error saying... 'BP Callout' does not inherit from 'Child Actor Component'.

Which led me to this post titled 'Using Child Actor component as Object reference' https://forums.unrealengine.com/t/blueprint-does-not-inherit-from-child-actor-component-cast-to-would-always-fail/555398 where ClockworkOcean replied... You have to do a ‘get child actor’ before the cast.

Which did the trick. 

So, in conclusion, if you have a blueprint as a child of another blueprint and you want to access a function on this child blueprint, you 

1. drag out the child blueprint and click 'get' to create a reference to it 
2. create a 'get child actor' node and set the ref you just made as the target - 
3. From the child actor out pin you make a Cast to [Blueprint Name]. 
4. Then from the 'As [Blueprint Name]' out pin, drag out and select the function within your child blueprint you need to use (ie. SetCalloutText).

BUT, NerdKing Leo says I can use Events like I do in Unity - so he's going to show me and that will probably be an even better solution. 

Comments

Popular posts from this blog

Unreal - Creating a Distance Field Font

Paintings