impemented serialize function and implemented it for component SpawnNode