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"

Structs Extremely Unstable - Alternative To Structs?

When I am using a struct to store information such as having a Struct for a Character (storing their name, class, equipped gear, etc.), it has become quite tiresome to get random crashes when some values are added/changed.

The random crashes seem to be trying to reference values that no longer exist, or values that have changed, or default values. Whenever I edit a struct that is being referenced elsewhere, it has something like a 15% chance that struct will become corrupt and crash the project when it is referenced in-game. And I have no way of finding out why, where, or how it became so.

Everything else so far has worked pretty well in UE4, but having to make a new struct and go through blueprints one at a time and re-hook up the new reference is becoming REALLY tiresome.

Does anyone have a suggestion for an alternative to Structs, or a fix for this?

Product Version: UE 4.15
Tags:
more ▼

asked Jun 23 '17 at 07:26 PM in Blueprint Scripting

avatar image

Ascent_Zieg
31 3 8

avatar image a_nde Jun 23 '17 at 10:04 PM

Sounds weird, What nodes do u use to get and set variables in these structs?

avatar image Ascent_Zieg Jun 23 '17 at 10:45 PM

Usually using either Set Members or Break, to either set the variables or break them apart for read.

avatar image a_nde Jun 23 '17 at 10:58 PM

Puhh, hard to tell. I never get crashes while working on structs. But i think there was an issue in older engine versions with setting in array structs.

i just looked into the Release-Notes of 4.16:

New: 'Array Get' node. Can toggle between returning a reference or copy. Using a reference solves a longstanding issue with arrays of structs not being able to easily make changes to the items in the array.

maybe this update helps u. Otherwise check with branch or isValid-nodes, wether one object u wanna reference is there or not.

Hope that helps.

avatar image Stratego99 Jun 23 '17 at 11:35 PM

4.16 had several fixes regarding structs, such as the ability to edit a struct directly from an array. So updating if possible might fix your issues.

However, this issue seems to be describing your problem and is currently backlogged, so you might find out more here: https://issues.unrealengine.com/issue/UE-21554

avatar image Ascent_Zieg Jun 24 '17 at 02:04 AM

Still on 4.15, not sure I want to move to 4.16 until the next milestone build is finished.

I do use mapped structs within a save game as a temporary database of sorts, instead of using 1 savegame object per character slot I simply have a save game with int's used as ID's mapped to structs of character variables.

When I try to update the character struct, often it causes large issues with the structs that are referenced throughout the project. Often even clashing with itself, saying that it isn't the same type as itself when the names are identical and I have no other similar structs.

The save games themselves are another issue when referencing the structs, sometimes the savegame file will corrupt and crash the project when loading at around 94-95% specifically, forcing me to revert back to an earlier revision in version control and manually redo the changes.

Just a mess of issues. But yes your link seems to be the issue I am experiencing, at least with changing the struct variables.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Not sure i really understand what u are doing with the structs and savegames, but it sounds very complicated. I bet u are doing something that is not intended by the engine.

When u just want to temporarily save data of characters or actors and u have instances of these in game, just keep the changes in the character/ actor and save it when leaving the game or on level change. In the marketplace there is the Rama Save System i would use for saving actor/character related stuff for such things. It will save u so much time, believe me. Instead of fighting with the save game slots u just add a component to the actors u wanna save and the system saves all info u want whenever u want.

more ▼

answered Jun 24 '17 at 08:59 AM

avatar image

a_nde
51 4 7 17

(comments are locked)
10|2000 characters needed characters left

I would guess that the crashes arent caused by the actual structs but that your are trying to access a struct array with an index greater than length (for the crashes). Check maybe that the array ID values are never greater than the length with a simple branch and breakpoint when playing.

more ▼

answered Jun 24 '17 at 09:25 AM

avatar image

bennetherwood
189 21 21 34

(comments are locked)
10|2000 characters needed characters left
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