Issue attaching to parent actor on android

In a c++ puzzle game I’m spawning actors from a blueprint class in a grid and attaching them to the grid actor.
This using AttachRootComponentToActor.
I set up a simple movement and after some time the app run I see child detach from parent on spot and not moving any more with it.It seemed to be deterministic but it is bit as on a 64tile grid it start most of the time with the 30th actor attached then it may or may not follow a precise pattern (es sometime 30 31 and 32 are detached in sequence, but sometime it detaches other tiles first).
I tested with 2 different blueprint The issue is present with very default ones One with Paper2d sprites as root component and one with static mesh as root component.
The issue seems to be present on android but not in editor on where I tried to reproduce it without luck.
It happens in development and shipping deploy.

// Called when the game starts or when spawned
void APuzzleGrid::BeginPlay()
{
	Super::BeginPlay();
	InitPos = GetActorLocation();
	check(GridSetup.VisualTileClass);
	//fill both data and visual tiles linear arrays.
	int32 size = sizeX * sizeY;
	//data with default value.
	DataTiles.Reserve(size);
	DataTiles.AddDefaulted(size);
	//visual from blueprint set in editor of AVisualTile base class.
	VisualTiles.Reserve(size);
	FVector Location = FVector(0.0f, 0.0f, 0.0f);
	FRotator Rotator = FRotator(ForceInitToZero);
	FActorSpawnParameters spawnParams;
	spawnParams.Owner = this;
	spawnParams.bNoCollisionFail = true;
	AVisualTile* newVisualTile;
	//Basic rectangular grid setup with square tiles.
	int X, Y;
	
	for (Y = 0; Y < sizeY; ++Y)
	{
		Location.Z = Y * GridSetup.tilesize;
		for (X = 0; X < sizeX; ++X)
		{
			Location.X = X * GridSetup.tilesize;
			newVisualTile = GetWorld()->SpawnActor<AVisualTile>(GridSetup.VisualTileClass, Location, Rotator, spawnParams);
			check(newVisualTile);
			newVisualTile->AttachRootComponentToActor(this);
			VisualTiles.Add(newVisualTile);
		}
	}
	Init();//blueprint side call needed as BeginPlay seems to be called first on blueprint Bug?!?.
}


// Called every frame
void APuzzleGrid::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	Accumulator += DeltaTime;
	this->SetActorLocation(InitPos + sin(Accumulator * 10) * 10);
}

This is the minimum code to reproduce the issue on nexus 7 (2nd gen).

Hey Deadlineproof-

There is still some additional information I need to test your issue. There are a number of what appear to be variables (GridSetup, sizeX, sizeY, DataTiles, VisualTiles, Accumulator) that doesn’t seem to be defined anywhere. I’m also not sure what the for loop is doing exactly. Is this code being added to an actor class or another class? If possible could you end a small sample project that has this bug occurring so that we can investigate it directly?

Cheers

Made a project that shows the problem. you can download it here File Dropper - Online file sharing
it spawns tiles from a blueprint class adding it to a grid parent that moves.

Clicking on the link gives me a 404 error. Could you upload the project to dropbox and then send me the link to it either here or as a pm on the forums?

The bug on my device presents itself approximately after a minute.

Hi Deadlineproof,

I’m hoping to try and attempt a reproduction of your issue today. Can you tell me what Android device you’re testing, and how you’re deploying the project to the device?

Device is nexus 7 2nd gen (a15 quad + adreno 320) running android 5.1.1.
I packaged with both dev and shipping config and deployed with adb by the ue4 provided bat file.Both configs presents the error after 1 minute or so.
I haven’t checked on device if the parent/child relationship is still intact on actors after they get detached by this issue.

Hi Deadlineproof,

I’m unable to open your project in any version of the editor that I have available. Can you resend, and make sure to delete the Saved and Intermediate folders before you send.

Thanks!

I cannot see how it may change something to resend the same exact files again(same CRC).I can do it as I don’t know why it doesn’t open and as you are the engine experts and are supposed to know.However I’m pretty sure the project and actor assets are not so relevant in this issue as they are both really basic. The key is in the CPP code.

Hey Deadlineproof-

Looking over the code for your project I noticed that the for loop posted above uses Location.Z = Y *GridSetup.tilesize. Without being able to open the project I can’t say for certain if this is part of your issue but could you mean to use Location.Y rather than Location.Z (since your variable is Y this is just an assumption). Also in your Tick() function it seems you’re moving the entire grid in some sort of sin wave pattern?

You mention attaching blueprint spawned actors to your code based grid actor (if I’m reading your post correctly). How exactly are the BP actors being attached to the grid? Is the movement you’re referring to set up on the BP actor or the movement of the grid in its Tick() function?

Additionally, which version of the engine was the project that you uploaded saved with? The error wittlief and I receive when opening the project mentions that it’s saved with a different version of the engine. If you were working in a 4.8 preview build prior to preview 4 this may be causing the issue. Saving with the latest preview and resending it may allow us to open it and look at the blueprints you’re using with the code.

Cheers

grid is the parent and it is moving correctly,
Child bp are attached to grid with newVisualTile->AttachRootComponentToActor(this);
and move correctly with the parent since the issue presents itself making few of them randomly detach.

project version was 4.8 prior to 4 I have formatted my since them i will try to make the conversion myself and let you know if new preview fixed the issue.
In any case I can provide you the apk and obb where the issue is present to test in other devices.

I will pm you when I got the opportunity to check the newer version.
But I guess that if you have encountered problem opening the project I will have them too however it is not so hard to make an ad hoc project as assets are very basic ones.

Now that 4.8 has released you may want to check on that version rather than using a preview version.

Hi Deadlineproof,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.