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"

Cook and Package Fail. Error component attach, worked in previous versions

This is related to other bugs posted, such as link text:

I have tried packaging first, then cook. Also I have tired deleting Intermediate and saved folders, same fail on package and cook.

I have classes that extend UMarkerComp. They are used to help generate procedural content. There was no issue with them through 4.10.

Here is an excerpt, one of the errors:

MainFrameActions: Packaging (Windows (64-bit)): UE4Editor-Cmd: [2016.05.25-05.09.59:321][ 0]LogSceneComponent:Error: Component 'PickupMarker /Engine/Transient.TRASHCLASS_BaseBlockWorld1_299:PickupMarker_0' has 'BillboardComponent /Engine/Transient.TRASHCLASS_BaseBlockWorld1_299:PickupMarker_0.Billboard' in its AttachChildren array, however, 'BillboardCompon ent /Engine/Transient.TRASHCLASS_BaseBlockWorld1_299:PickupMarker_0.Billboard' believes it is attached to 'PickupMarker /Script/JLemon.Default__PickupMarker'

Here is the header of the class:

 #pragma once
 #include "MarkerComp.h"
 #include "PickupMarker.generated.h"
 UCLASS(ClassGroup = (Lemon), meta = (BlueprintSpawnableComponent))
 class JLEMON_API UPickupMarker : public UMarkerComp
     // Sets default values for this actor's properties
     UPickupMarker(const FObjectInitializer& ObjectInitializer);
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pickup")
     TSubclassOf< class ABasePickup > PickupSpawnClass;
     // Called when the game starts
     virtual void InitializeComponent() override;
     // Called every frame
     virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

And here is the .cpp file:

 // Fill out your copyright notice in the Description page of Project Settings.
 #include "JLemon.h"
 #include "PickupMarker.h"
 // Sets default values
 UPickupMarker::UPickupMarker(const FObjectInitializer& ObjectInitializer)
 : Super(ObjectInitializer)
     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
     bWantsInitializeComponent = true;
     PrimaryComponentTick.bCanEverTick = true;
     // Structure to hold one-time initialization
     struct FConstructorStatics
         // A helper class object we use to find target UTexture2D object in resource package
         //TODO: Change Icon to PickupIcon
         ConstructorHelpers::FObjectFinder<UTexture2D> Texture0;
             : Texture0(TEXT("Texture2D'/Game/Lemons/Procedural/Blocks/Blueprints/icons/AmmoMarker'"))
     static FConstructorStatics ConstructorStatics;
     BillboardComponent = ObjectInitializer.CreateEditorOnlyDefaultSubobject<UBillboardComponent>(this, TEXT("Billboard"), true);
     SpriteTexture = ConstructorStatics.Texture0.Object;
     BillboardComponent->Sprite = SpriteTexture;
 // Called when the game starts
 void UPickupMarker::InitializeComponent()
     // ...
 // Called every frame
 void UPickupMarker::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
     Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
     // ...

Product Version: UE 4.11
more ▼

asked May 25 '16 at 05:39 AM in Packaging & Deployment

avatar image

2.5k 102 67 261

avatar image mikepurvis May 26 '16 at 02:25 PM

I commented out the code, again I can package.

But, it's not a good solution as this worked all the way from 4.6 until now. It provided icons for the markers so could visually tell what type they were and it aided placement.

How are you supposed to change the icons of classes extending Marker?

avatar image Matthew J May 26 '16 at 03:05 PM

Hello mikepurvis,

I'm actually fairly surprised that this ever worked. Seeing as you're doing all of this within "#if WITH_EDITOR", none of it will ever be included in the packaged game. This also means that the FConstructorStatics struct will never be defined. You also may want to take this line out of "#if WITH_EDITOR" if you're doing anything on tick with this class:

 PrimaryComponentTick.bCanEverTick = true;

If any instances of this class are placed in the level when package, it'll attempt to package them and then notice that they are referencing things that don't exist (since they are only in the editor) and give you these errors.

avatar image mikepurvis May 26 '16 at 04:17 PM

Thanks, tonight I will try removing the In Editor only but the reason I had it was because of:

 ObjectInitializer.CreateEditorOnlyDefaultSubobject<UBillboardComponent>(this, TEXT("Billboard"), true);

I only need the billboard sprite in the Editor, and it only needs to tick in Editor, to face the billboard. It shouldn't care what it is when running the game.

This worked for more than a year until 4.10. It broke temporarily on a similar class extending Marker, but then started working again. It builds for other similar classes by the way, all with the same type of constructor code.

What is the correct way to change the sprite when extending a Marker component?

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

1 answer: sort voted first

I didn't think about this before, but one issue is that you're calling AttachTo in the constructor. It'll sometimes work, but it can cause some weird symptoms like this. In versions 4.11 and earlier, you'll need to set AttachParent when attaching in the constructor. From 4.12 and onwards you would call SetupAttachment instead.

more ▼

answered May 26 '16 at 06:09 PM

avatar image mikepurvis May 27 '16 at 01:47 AM

It has to use #if WITH_EDITOR, if you look in the base class UMarkerComp, BillboardComponent and SpriteTexter are declared within a #if WITH_EDITOR block.

So, it appears changing it from the function AttachTo to assigning the AttachParent directly allows it to build again.

avatar image Matthew J May 31 '16 at 01:23 PM

Hello mikepurvis,

Due to your latest comment, I've converted my previous comment into an answer as it seems like that change solved your problem. If my assumption is wrong, please let me know and we can continue.

(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