diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs index 6f1394b25e..887c39bbdd 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs @@ -41,11 +41,17 @@ namespace OpenRA.Mods.Common.Traits public GrantConditionOnPrerequisite(Actor self, GrantConditionOnPrerequisiteInfo info) { this.info = info; - globalManager = self.Owner.PlayerActor.Trait(); } void INotifyCreated.Created(Actor self) { + // Special case handling is required for the Player actor. + // Created is called before Player.PlayerActor is assigned, + // so we must query other player traits from self, knowing that + // it refers to the same actor as self.Owner.PlayerActor + var playerActor = self.Info.Name == "player" ? self : self.Owner.PlayerActor; + + globalManager = playerActor.Trait(); conditionManager = self.TraitOrDefault(); }