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"

Can't detach wepon/actor from mesh

Im using a free inventory system from the epic games store link is bellow and i am using the use item event to create a hatchet and set a variable and give the hachet back and when that variable is true to detatch the hatchet but im getting the error bellow code, inventory system and error down bellow

Inventory system: https://www.unrealengine.com/marketplace/inventory-system

Code: alt text

alt text

Error/Warning: Blueprint Runtime Error: "Accessed None trying to read property Hachet". Blueprint: UseHachetBP Function: Execute Ubergraph Use Hachet BP Graph: EventGraph Node: DetachFromActor

Product Version: UE 4.21
Tags:
screenshot-1.png (533.0 kB)
screenshot2.png (367.1 kB)
more ▼

asked Nov 16 '18 at 04:01 PM in Blueprint Scripting

avatar image

Veathen
9 4 3 10

avatar image Erasio Nov 16 '18 at 04:49 PM

"Accessed none" generally refers to an empty variable.

Are you absolutely sure the "Hachet" reference is stored within that variable right before you attempt to detach it?

Have you maybe set some of those bools to an incorrect default value?

avatar image Veathen Nov 16 '18 at 10:40 PM

Sorry it took me so long to get back to you but i am completely sure i have the right default values for the Bools and im sure that the variable has a reference to the actor that was spawned before it is attached and if that is the problem how do i get a reference to a actor attached to a socket?

avatar image Erasio Nov 17 '18 at 09:57 AM

Well, a reference to the actor is correct as for attaching / detaching.

But lots of things can happen to the object or variable in between.

This is why I asked whether you're sure. Being sure and expecting something to be are two very different things ;)

You should use the BP debugging tools to verify and to be sure it's working as intended. Because evidently something doesn't work as you would expect so the task now is to figure out where exactly you loose the reference. Is the object you attached destroyed somewhere? Is the reference removed or overwritten? Is something stored in a different BP instance than where you wanted it?

Lots of things can happen quite easily even to very experienced programmers!

All I can tell you from those pictures at this point is that when that error happens the variable is empty.

And that your code structure or at least the way you access things feel a bit unorganized. Directly accessing variables and especially manipulating in other classes is not quite ideal as it makes debugging a lot more difficult, requiring you to jump across lots of classes.

Example: Right now you attach the hatchet to the player character from within a class that's not your player character. This prevents you from storing the variable together with the actor you attached it to and leaves you without a location within the player character, where you could debug this.

I would create two functions within the player character which attach and detach the hatchet. Attaching must provide a hatchet reference. Detaching doesn't need to. And within the player character you can then store the hatchet itself and check when and where exactly the variable is set, when it's attached and what exactly happens to this section of code. In exactly one instance of one class.

avatar image Erasio Nov 17 '18 at 12:40 PM

Oh, I also just noticed that you use attach to component and remove from actor.

Given the error message, you definitely have an issue with your variable but you should also make sure to use functions consistently. Either attach and detach from actor or attach and detach from component. Mixing probably won't work so well here ;)

avatar image Veathen Nov 17 '18 at 04:40 PM

ok i moved everything over to the character i got the detach to work now the attach is just making the axe disappears then when i detach it it appears again not being attached so thats working is my socket broken or something i'm very confused now

avatar image Veathen Nov 17 '18 at 05:02 PM

oh yea managed to get rid of all the errors but still cant get the attach to work properly

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

0 answers: sort voted first
Be the first one to answer this question
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