Packaged game has projectile issues

Hello I packaged my game and I found bugs that were not present while testing in editor. The game was much better in editor.

I packed in the development mode.

  1. The packaged game was not detecting collisions. The object were simply passing inside each other.

  2. I spawn projectile through a subobjectcomponent something like

Code:

FRotator SpawnRotation = GetOwner()->GetActorRotation();
GetWorld()->SpawnActor<ABaseProjectile>(NormalProjectileClass, ProjectileSpawnLocation, SpawnRotation);

But in the packaged game, the projectiles were spawning in another direction. These bugs kind of freaked me… Any reason for this?

Yes, another thing… My main character was a pawn and its floating in the air… And there is another actor whose location I set to the main characters location with something like this

Code:

void APlayerShieldActor::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	if (GetOwner())
	{
		float OwnerX = GetOwner()->GetActorLocation().X;
		FVector NewLocation = GetActorLocation();
		if (OwnerX > NewLocation.X)
		{
			NewLocation.X = OwnerX;
			SetActorLocation(NewLocation);
		}
	}
}

This actor is like miles ahead of the player.

Hi envenger,

For what platform are you developing?

Windows…

Ok, are you using the binary or the source version of the editor, and what update are you using?

The source version. I download it from github.

version 4.7.5

Is it someway related to this

I have alot of custom structures in my game.

Mb it because sometimes Editor package old version of game (like 2-3 day ago version). Happens with me couple times

Hey envenger-

It sounds as though you have multiple issues happening (the projectiles and the character issue). I will focus on the projectile issue here since that is the title of the post, however you should create a separate post for the issue with the character pawn/follow actor. This will make it easier to search and find information on the bugs easier in the future.

As for the projectiles, how are you setting the collision for the projectiles? How do they interact inside the editor with Play In Editor vs running as Standalone? Can you post the full code (source and header) for the projectile so we can see how it is setup and how it works?

Cheers

I think I find mostly the root of the errors…

Basically… My pawn is made out of different staticmesh components (5) attached to each other.

I am moving them per tick through the SetActorLocation(). It works well in the editor.

Bu in the original game, all mesh stays at 1 place(not the origin I think) but, when I check the location of the actor through Screenmessages, the actor location is shown to be moving.

Hey envenger-

If I understand correctly you’re using pawns for your projectiles, correct? A better option would be to use actors instead. A pawn is used primarily for something that will be controlled by either the player or AI whereas an actor represents objects in the world (doors, chairs, etc). Since the player wouldn’t control the projectiles it would be best to set them as an actor. You may want to take a look at the ProjectileMovementComponent source and header files for the first person template project for an example of how to setup a projectile through code.

No, I am using Pawn as the playable character which is firing projectiles(actors).

I am sending you a few screenshots on the difference between editor and standalone game.

This is how the game looks in editor.

This is how it looks in standalone…

All actor are smashed into 1 place. But when I see the actor location through GetActorLocation() and display it on the screen, it shows the curret location. But here the actors are jammed into 1 place and not moving.

Are the three rows of actors in the first picture the projectiles you mentioned or are they other actors? Could you explain the images help me understand what’s happening in the game. If possible could you send a copy of your project so that I can look at the problem and code directly? If you can upload the project to dropbox you can send me a private message on the forums with the link to access it.

Thanks

Okay, I will sending you it within the next 2 days… Also I will let you know what all I have rested and how far has it gone…

Thanks…

Hey envenger-

I’ve not heard from you in a few days. For now I will be marking this post as resolved for tracking purposes. If you’re still having problems with the projectiles in your game, please feel free to reopen the post with a comment and we will continue to investigate. Be sure to include any information that could hep us reproduce the issue including a sample project if possible.

Cheers

Hi Dough,

I couldn’t solve the problem. There was some major problems with my Internet and I had to change my ISP.

My internet is back and I finished uploading.
I am sending you through a private message on the forums.

Hey envenger-

I’m still looking into the behavior differences of your project. Something I noticed is that when in PIE mode the actors (player/shields/enemies) will move along the board and you can see the board scrolling by. I’ve not found the reason, but when playing in Standalone I noticed that the board does not scroll at all. Not sure where this functionality is set up but that may be something to look into. Additionally, the issue of the projectiles not moving forward in a packaged product seems to be caused by the projectile’s speed not being set properly when it’s spawned. Again I’ve not been able to find why but hopefully this gives you an idea of where to look. I will continue to try and find the root problem but hopefully this is enough for you to continue moving forward with the project.

Cheers

I found the reason why this was happening…

Its pretty stupid of me actually. When creating default actors, I was using
CreateEditorOnlyDefaultSubobject
Mostly I copy paste that part of the code so my whole project had that.

I am working on this as my side project so I didn’t have time to check it up.

Hey envenger-

I’m glad you were able to find what was causing this problem. If you use CreateDefaultSubobject instead of CreateEditorOnlyDefaultSubobject do you then get the same behavior between editor and standalone modes? If you are still having issues with different behavior between play modes feel free to comment here and we will investigate further.

Cheers

Changing CreateEditorOnlyDefaultSubobject to CreateDefaultSubobject solved every other problem with that game.

Have not tested any further but the behavior between the editor and standalone seems to be the same.