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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Scale Blueprints

Hi. Increasing the width of a square is very easy using javascript. Here is the code that increases the width of the square with each click of a button by 5 pixels:

 <input type="button" value="Start" onclick="resize()" id="scale">
    
    <div id="cube" style="background: #6a6a6a;width: 100px;height: 100px;"></div>
    
    
    
     <script>
        var x = 100;
        function resize() {
            x = x + 5;  
            document.getElementById('cube').style.width = x + 'px';
         }
     </script>
 

How to increase the width of the cube with each button click using blueprints?

Product Version: UE 4.21
Tags:
more ▼

asked May 20 '19 at 01:25 PM in Blueprint Scripting

avatar image

SFX_er
8 1 4

avatar image SFX_er May 20 '19 at 01:53 PM

This blueprint increases the X value after the start of the game.alt text

scale.jpg (336.8 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You have the correct node, you just need to create a widget (if you want a UI button) and connect it to that node or if you want a keyboard button search for the keyboard button by right clicking the event graph in your player character or player controller or level BP (these are the most commonly used BPs to receive player input) and then select the keyboard input event from the list and hook it up to the node you have there.

more ▼

answered May 20 '19 at 02:39 PM

avatar image

Nebula Games Inc
5.3k 27 9 14

avatar image SFX_er May 20 '19 at 02:54 PM

No. I want to press a keyboard button (for example, button E) to increase the width of the cube. And I do not know how to do it.

avatar image Nebula Games Inc May 20 '19 at 02:59 PM

Search for "E" in the event graph of the player character/controller and connect it to that node as I show below.

alt text

press-e.jpg (43.5 kB)
avatar image SFX_er May 20 '19 at 05:53 PM

I made in Level Blueprint and everything began to work. I don't understand why it didn't work in the Cube blueprint.... Thanks a lot for your help !

avatar image Nebula Games Inc May 20 '19 at 05:57 PM

If the cube is not a pawn/character you don't receive input events. That is why I mentioned the level, player character/pawn or controller. Anyway, glad it works now :)

avatar image SFX_er May 20 '19 at 06:24 PM

Thank you. But how to increase the width of the cube each time you press a button usingblueprints? That was my question

avatar image Everynone May 20 '19 at 07:52 PM

alt text

capture.png (50.6 kB)
(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