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 not set default value of object reference variable

I can not get my variable "newvar_0" to have it's default value set to the object pawn "Dhunt_camera". The only way i can get the variable to work properly is to click each instance of the object using the variable in the level and manualy set it's value to the camera from the level. However, this will not work for an object that is spawned later since it can not find a default value. alt text

alt text

Product Version: Not Selected
Tags:
more ▼

asked Mar 18 '15 at 05:37 PM in Blueprint Scripting

avatar image

Hunkuleswjc
16 5 6 9

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

1 answer: sort voted first

However, this will not work for an object that is spawned later since it can not find a default value.

That is exactly the reason why you can't set a default. The variable can not assure that this object exists during runtime. You need to get a reference from somewhere else (not a direct reference to the object by default or the level script). This can be achieved by spawning those actors, receiving them via "Get All Actors of Class", overlap / collision events or by passing down a reference from somewhere else. That's pretty much the very basis of object orientated programming.

I hope this helps a bit even though it does not actually solve your issue.

Cheers :)

more ▼

answered Mar 18 '15 at 06:03 PM

avatar image

Erasio
5.9k 291 86 293

avatar image Hunkuleswjc Mar 18 '15 at 06:11 PM

Thank you so much. So i have it now set that variable to an array outputted from the get all actors. It works so far, but will it cause problems later on?

avatar image Erasio Mar 18 '15 at 09:25 PM

That really depends. It will reliably pick the same one but it might not always be the one you want. If there is only one instance no. This will not cause any issues. Otherwise maybe.

avatar image Hunkuleswjc Mar 18 '15 at 06:16 PM

alt text

Probably not optimal, but it works for now.

(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