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"

Unable to find USpringArmComponent attatched to parent object

Hi Guys,

I am currently attempting to reference an attached spring arm that is a child component of an actor. See image:

alt text

From the UOrbitalCamera class, I have declared a pointer to the Spring Arm like this:

alt text

In the beginplay function, I attempt to find the SpringArm, and added some validation to protect against a null pointer. It compiles fine, and When i run the game, I can see the output confirming that a SpringArm has been found.

alt text

I have another, public function called "Zoom". This is called from another class. I have confirmed that the function is being called successfully, because of the UE_LOG output during runtime. However, at this point it appears as though the pointer has reverted to a null pointer??? The validation prevents a crash but If i remove it, the editor crashes, and I assume that I encounter a nullptr ex...

alt text

I really have no idea why this isn't working, I am new to C++ and may have missed something but this does not seem to be the case...

It might be worth noting that when I tried to expose SpringArm as a UPROPERTY(EditAnywhere) and reference the component in the editor, there was no SpringArm available in the drop-down menu. Maybe that is related.

Thanks, S

Product Version: UE 4.10
Tags:
0_heirarchy.png (9.7 kB)
0_header.png (3.1 kB)
0_beginplay.png (18.6 kB)
0_publicfunc.png (16.0 kB)
more ▼

asked Apr 08 '16 at 11:28 AM in C++ Programming

avatar image

Steinberg
8 1 2 6

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

1 answer: sort voted first

EDIT: I figured this one out myself.

I got a clue when I realised that my variables were resetting themselves during run-time.

The class from which I was calling the Zoom function, had a reference to this (UOrbitalCamRig) as a TLazyObjecPtr. I dont know enough about c++ yet to understand why it was screwing it up, but it was... I guess it really is a lazy pointer!!!

Either way, I switched it over to a normal pointer and located this class using the actor iterator (LINK). It all works now.

more ▼

answered Apr 08 '16 at 04:24 PM

avatar image

Steinberg
8 1 2 6

(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