Hello,
I have created a Blueprint Pawn in which I added a C++ scene component. In that scene component, I created a UCapsuleComponent. In the Blueprint for the pawn, I change the shape of the capsule component. I compiled for Android and validated that everything worked fine without the “nativize BP assets” option.
Once I enable the “nativize BP assets” option, the shape of the capsule collider is wrong once running on Android. I am not sure if this bug affects other platforms and other types of components.
I have an example projects here (pretty big, it contains the starter content, sorry): Google Drive
To reproduce:
1- Create a C++ Scene Component:
MySceneComponent.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Components/SceneComponent.h"
#include "MySceneComponent.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MYPROJECTBUG_API UMySceneComponent : public USceneComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UMySceneComponent();
// Called when the game starts
virtual void BeginPlay() override;
// Called every frame
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UCapsuleComponent* MyCollider;
};
MySceneComponent.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyProjectBug.h"
#include "MySceneComponent.h"
// Sets default values for this component's properties
UMySceneComponent::UMySceneComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
MyCollider = CreateDefaultSubobject<UCapsuleComponent>(TEXT("ArmCollider"));
MyCollider->SetupAttachment(this);
MyCollider->SetCollisionProfileName(TEXT("OverlapAll"));
}
// Called when the game starts
void UMySceneComponent::BeginPlay()
{
Super::BeginPlay();
// ...
}
// Called every frame
void UMySceneComponent::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
{
Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
// ...
}
2- Create a new Pawn Blueprint
3- Add MySceneComponent to the Pawn Blueprint
4- Change the shape of the capsule component in the Pawn’s MySceneComponent. Make it pretty distinctive from the default shape so it’s easy to tell if it’s wrong once in game.
5- In the level blueprint, add a “execute console command” node with the command “show collision” to see the colliders in game.
6- Package the project for Android, with the “Debug” configuration to see colliders in game. Make sure the “nativize blueprints” option is enabled.
7- Install the package on an Android device (in my case it was an LG G4), using the generated “Install_MyProjectBug_DebugGame-armv7-es2.bat” file.
8- Run the game on the device. You will see that the collider’s shape is now different than what is in the editor.
9- Packaging the project without the “nativize blueprints” option should fix the issue.
Thanks!