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"

Getting ‘Accessed none trying to read property’ when trying to change the materials of static mesh component objects that are stored in an array

Hi everyone, I have been having an issue where I want to change the materials of the cones that a blueprint has spawned through an Add Static Mesh Component node. All of these cones have been placed in an array that can be accessed elsewhere (for this case, the level blueprint). alt text In the level blueprint, it is supposed to get the array of cones and then, for each of the cones, alternate its material between green and white. alt text I seem to be having two problems, the first being that the array of cones gets larger and larger every time I make a change to the blueprint in the level.

The second being that ingame, the message log fills with so many errors it almost brings the engine to a halt. The errors are as stated in the title of this question. The cones also don't change colour either. alt text I've had this issue numerous times over several occasions where I have tried to do something similar to this but I have never been able to figure why it happens. I was hoping someone here would know. So if anybody here knows why this happens, it would be much appreciated if you could tell me.

Thanks! Goolog

Product Version: UE 4.20
Tags:
more ▼

asked Nov 04 '18 at 08:38 AM in Blueprint Scripting

avatar image

Goolog
10 2 6

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

1 answer: sort voted first

The object or property you're trying to access is either not initialized yet or is being garbage collected. Use the "IsValid" macro for the object or the property prior to using it in your logic. This will stop the logic (and those errors) if what you're trying to access is not actually available.

Your loop on tick also confuses me, tick is triggered every frame. There's no reason for you to re-loop everything manually.

more ▼

answered Nov 05 '18 at 06:55 PM

avatar image

MajinSephiroth
1.2k 31 8 33

avatar image Goolog Nov 06 '18 at 09:21 PM

I fixed up the script so that It no longer includes the loop and used the isValid node. Everything works properly now. Thanks for your help!

(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