- Home /
Player crash during the loading of a level
In my project, i have different scenes and I am encountering a problem with one of them.
I have a pathfind generator that builds a list of nodes and links (both ScriptableObject), serialized in a MonoBehaviour derived class. The generator works great : visual representation is correct.
When I start the level in the Editor, it's OK.
When I start the default level and load this level in the Editor, it's OK.
The problem occurs when i try to load this level from a standalone player. I looked at the output_log but there is no error or warning.
EDIT :
I have found what lines are causing the issue. But I can't figure out why it is happening. In a script that is executed only in the Editor for the generation of my pathfind, I check if there is a wall between two nodes using a set of raycasts. This set is used to set the proper type of the link (normal, through window...) between the two nodes.
The error in the standalone players appears only when : - the link type is a window - the link is joining a left node to a right one (see code below)
PathNode.ENeighbor eInversedNeighbor = PathNode.GetInversedNeighbor(a_eNeighbor); // right if a_eNeighbor is left, back if it is front...
PathLink link = ScriptableObject.CreateInstance<PathLink>();
link.SetNodes(Me, Neighbor, nLinkType); // just setting some serialized attributes
Me.SetLink(a_eNeighbor, link); // just setting some serialized attribute
Neighbor.SetLink(eInversedNeighbor, link); // idem for the other node
// add the link to the path holder
PathHolder path = (PathHolder)serializedObject.targetObject;
path.m_lLinks.Add(link);
if I comment the line " Me.SetLink(a_eNeighbor, link);", the level can be loaded.
The function SetLink :
public void SetLink(ENeighbor a_eNeighbor, PathLink a_Link)
{
Assertion.Assert(a_Link != null, "invalid link");
Assertion.Assert(GetLink(a_eNeighbor) == null, "link already set.");
switch(a_eNeighbor)
{
case ENeighbor.eLeft: m_LeftLink = a_Link; break;
case ENeighbor.eRight: m_RightLink = a_Link; break;
case ENeighbor.eFront: m_FrontLink = a_Link; break;
case ENeighbor.eBack: m_BackLink = a_Link; break;
default: Debug.LogError("Invalid Neighbor"); break;
}
}
Answer by gribbly · Mar 27, 2013 at 07:22 PM
Add a GUITexture temporarily, and log messages to it that show you were you are in your code. When it crashes, you'll be able to see the last message and figure out roughly where it's crashing. You can also log object names/nulls etc.
it is crashing during the loading of the level by unity engine.
None of my level scripts get the Awake message.
None of my ScriptableObject get the Enable message.
Your answer
![](https://koobas.hobune.stream/wayback/20220613095217im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Standalone server crash 1 Answer
Game crashes on Loadlevel when called on a swipe event 1 Answer
Unity crashes on building project 2 Answers
Game crash on Ubuntu 2 Answers
crash in standalone but not in editor - appears to be caused by UI 1 Answer