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"

hex grid is running oddly slow.

I have made a hex grid which works as intended but it runs extremely slow and was wondering if there was any way to solve this. here are some screenshots of the code and the desired effect:alt textalt text

Product Version: UE 4.21
Tags:
capture1.png (598.5 kB)
capture.png (290.1 kB)
more ▼

asked Jun 05 '19 at 02:28 AM in Blueprint Scripting

avatar image

dillzilla
23 1 7

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

2 answers: sort voted first

Instead of use staticmeshcomponents, use one instancedstaticmeshcomponent, and call AddInstance in it.

Here is an example project with similar stuff

https://forums.unrealengine.com/community/community-content-tools-and-tutorials/1491686-free-procedurally-instanced-meshes

more ▼

answered Jun 05 '19 at 06:23 PM

avatar image

redbox
4.3k 81 19 104

avatar image dillzilla Jun 09 '19 at 10:49 PM

well my plan was to do this with tile actors in order to give each variables as to whether they've been built on, has resources available on them, etc...

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

I can't see that you delete all the previous static mesh components before you add new ones, therefore everytime you call the construction script it adds and adds new ones, without remove the already existing ones.

Hint: You can't see them properly in the viewport, because they are all at the same place, for a better debugging method get the count of current mesh components and print out that number instead of a string each time the function is called.

more ▼

answered Jun 05 '19 at 07:46 PM

avatar image

pDunkl
218 4 4 4

avatar image dillzilla Jun 09 '19 at 10:44 PM

i implemented a set of code that will add the items into an array and display the length of it each time the construction script is ran and the number matches the amount of objects that should be in the grid.

avatar image pDunkl Jun 09 '19 at 11:01 PM

Do you now delete the previous added meshes? - Because in your images it's not shown, that you do that. For example get the root->get children->for each loop->cast to floor tile->destroy component if successful. I just can't imagine, that these few (simple) static meshes would cause any lag, except they're beeing spawned over and over again...

With the "stat unit" command on, which segment causes the high ms?

avatar image dillzilla Jun 10 '19 at 12:32 AM

no. that's what i was wondering. if i added them to an array in the construction script and printed the count, wouldn't the count not be different i it was adding new ones each time the script is ran, assuming that this was the issue?

(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