Elements of Listare null after loading scene

Hi!
I have a serious problem with my Singleton.
I have “Skills” gameobjects, they have Image, Button and Skill Component.
In Skill Component I keep data like id, cooldown, damage etc.
It’s on my “Start Scene”

When the game starts I simply load skills values from XML - if no XML then I do a little magic and in the parent of all gameobjects with “Skill” Component I do

someparent.GetComponentsInChildren<Skill>()

This way I save all skills to XML.

Loaded skills I keep in singleton in AllSkillsList.
It has dontdestroydOnLoad, but when the next scene loads, Elements (Skill type) of the list are null.
List still have right amount - but objects in it are null.

What could cause that?

Could you debug this line like this. If the output is false, then the point the agents wants to move to, is not on the navmesh. Debug.log(agent.SetDestination(currentDest.transform.position));

1 Answer

1

Presumably, the someparent wasn’t transferred between scenes or its children weren’t. Do a GetInstanceID before and after the scene load and see if someparent and/or its children are actually the same object.

} else { Debug.log(agent.SetDestination(currentDest.transform.position)); } agent.SetDestination(gos1.transform.position); } this?

I've made my self a example scene with the same setup and everything works great. I can only help you futher, if you could share your scene, so I can test it for my self. If you dont want to do that, then I will convert my Answer to a comment, so your question gets more attention, from someone else.

my scene is not really that special, being a demo scene, what is the best way to share it with you?

http://www.mediafire.com/download/ginbh18g7odg1fk/Strategy1.unity this is a link to the scene, do you need more?

Yeah with just your scene I'am missing all your scripts and 3D models. Just copy your whole AssetFolder and upload it.