Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException #2

Closed
teknoman117 opened this issue Jul 29, 2014 · 4 comments
Closed

NullReferenceException #2

teknoman117 opened this issue Jul 29, 2014 · 4 comments

Comments

@teknoman117
Copy link
Contributor

NullReferenceException
at (wrapper managed-to-native) UnityEngine.MonoBehaviour:StopCoroutine (string)
at PQS.ResetSphere () [0x00000] in :0
at PSystemSetup.SetPQSInactive () [0x00000] in :0
at PSystemSetup.SetMainMenu () [0x00000] in :0
at PSystemSetup.OnLevelWasLoaded (Int32 level) [0x00000] in :0

Currently the only exception occurring, right up until a ship is launched. Then the whole PQS system dies for all planets, and the game dies in a fit of exceptions from almost every component of the game.

teknoman117 added a commit that referenced this issue Jul 29, 2014
…e prefab celestial body's game object as the parent of the prefab PQS controller's game object. The live CelestialBodyTransform is now referencing the live CelestialBody. However, a NullReferenceException still occurs in PQS.ResetSphere(). See Issue #2 on github.
teknoman117 added a commit that referenced this issue Jul 29, 2014
Merge branch 'master' of https://github.com/BryceSchroeder/Kopernicus

Conflicts:
	Kopernicus/KopernicusSystemSource.cs
@teknoman117
Copy link
Contributor Author

I think this is caused by some subtle difference between GameObjects that are a prefab and GameObjects that are created at runtime. This occurs whether we create the PQS from scratch or clone it from the existing prefab of another world. I think the answer to this problem will be how do you create a prefab at runtime? The PrefabUtility class is in the UnityEditor namespace, which isn't available at runtime.

@BryceSchroeder
Copy link
Contributor

Well, we could start by pursing in greater depth the ways in which a prefab
could possibly be distinct from an object created at runtime.
I just can't make head or tail of the results of the bug, though (like
why it affects the whole universe and not just the planet in question)

On 29 July 2014 17:22, Nathaniel Lewis notifications@github.com wrote:

I think this is caused by some subtle difference between GameObjects that
are a prefab and GameObjects that are created at runtime. This occurs
whether we create the PQS from scratch or clone it from the existing
prefab of another world. I think the answer to this problem will be how do
you create a prefab at runtime?


Reply to this email directly or view it on GitHub
#2 (comment)
.

@teknoman117
Copy link
Contributor Author

I'm fairly certain the reason that it effects the whole universe is because of the NullException - anything that would happen during that event after the PQS.ResetSphere call won't execute, because of the exception.

@teknoman117
Copy link
Contributor Author

Caused by created PQS prefab getting deleted by garbage collection. Solved by marking our prefab as don't destroy with UnityEngine.Object.DontDestroyOnLoad()

See commit
9a0ebe8

Sigma88 pushed a commit that referenced this issue Jan 19, 2020
Sigma88 pushed a commit that referenced this issue Feb 23, 2020
LGhassen pushed a commit to LGhassen/Kopernicus that referenced this issue Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants