- 
                Notifications
    You must be signed in to change notification settings 
- Fork 123
Open
Description
Describe the bug
NullReferenceException: Object reference not set to an instance of an object
AnyRPG.TradeSkillPrerequisite.UpdateStatus (System.Boolean notify) (at Assets/AnyRPG/Core/System/Scripts/Quest/TradeSkillPrerequisite.cs:28)
To Reproduce
Steps to reproduce the behavior:
- set any trade skill to auto-learn
- use the new game window and have any unit spawn in unit preview mode
Expected behavior
no error
Additional context
The exact issue happens on line 27 of trade skill prerequisite
bool checkResult = playerManager.MyCharacter.CharacterSkillManager.HasSkill(prerequisiteSkill);
When a unit preview spawns, the player character is not spawned yet, so the reference is null.
Possible solutions
- wrap these types of checks in if-then statement to prevent null reference
- drop support for players in the scene not spawned through unit spawn nodes. This prevents the automatic setting of unit type to AI in this case.
- only auto-learn skills if the player type is the actual player character. This requires testing to ensure that code that sets unit profile type to player is not re-triggered at any point.
Metadata
Metadata
Assignees
Labels
No labels