x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Random Image in Widget (HUD/MENU)

So im making a menu for my game, and i want at the bottom left a array of various images to appear, i searched it up and only got array tutorials, wich didnt help at all

I dont mind if you explain it with array's but i'd really like to know how to do it, and i'd also prefer with images as im not really experienced, thanks!

Product Version: UE 4.15
Tags:
more ▼

asked Nov 10 '18 at 09:35 PM in Blueprint Scripting

avatar image

NovaTedd
3 1 3

avatar image ThompsonN13 Nov 10 '18 at 11:00 PM

you need to explain you issue in more detail. what it sounds like is that you want several images to appear in the corner of the screen in which case you just add multiple image objects to the widget. that seems overly simple so you issue must have more to it that probably seems obvious to you but to the rest of us if you dont explain it in detail we will have no idea.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

An easy way to make newly added images push each other forward or add on to the end of a row is to add them to a Horizontal Box container widget with the Auto spacing rather than the Fill spacing option. Also how they displace each other or add onto the end can be controlled by setting the alignment to Left, Center, or Right.

To add an image widget you can use Create Widget node then use the output pin to set which image it is, which you can get from a Data Table or an Array.

more ▼

answered Nov 11 '18 at 03:35 AM

avatar image

mightyenigma
3.8k 18 20 20

avatar image NovaTedd Nov 11 '18 at 09:05 AM

No, its not just putting a bunch of images

Lets say you startup the game and the main menu loads, or you go back from the options menu and the main menu loads

Everytime the main menu loads a different picture will appear in the corner, completely random and non scripted, a luck game

I dont want to put a lot of images at once, but 1 image that appears randomly once a widget loads

avatar image mightyenigma Nov 20 '18 at 03:04 AM

Oh then just set the image widget as a variable and in the widget constructor (or if you just show/hide the widget instead of creating and destroying it, do this in the same function That Shows it), get a random int from range where the max is the length of the image array and set the image brush' texture to that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question