Skip to content

Commit 1733f2e

Browse files
committedJan 31, 2024·
Merge branch 'develop'
2 parents bb861cd + f9078b0 commit 1733f2e

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed
 

‎Runtime/DataTypes/SceneReference.Serializer.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ namespace JUtils
66
{
77
#if UNITY_EDITOR
88
[StructLayout(LayoutKind.Auto)]
9-
public partial struct SceneReference
9+
public partial struct SceneReference : ISerializationCallbackReceiver
1010
{
1111
[SerializeField] private SceneAsset _sceneAsset;
12-
13-
12+
13+
1414
public void OnBeforeSerialize()
1515
{
1616
if (_sceneAsset == null) {

‎Runtime/DataTypes/SceneReference.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using UnityEngine;
1+
using System;
2+
using UnityEngine;
23
using UnityEngine.SceneManagement;
34

4-
5-
65
namespace JUtils
76
{
87
/// <summary>
@@ -23,7 +22,7 @@ namespace JUtils
2322
/// }
2423
/// }
2524
/// </code></example>>
26-
[System.Serializable]
25+
[Serializable]
2726
public partial struct SceneReference
2827
{
2928
[SerializeField] private string _sceneName;
@@ -32,8 +31,7 @@ public partial struct SceneReference
3231
public string sceneName => _sceneName;
3332
public string scenePath => _scenePath;
3433

35-
public Scene scene => SceneManager.GetSceneByPath(_scenePath);
36-
public int buildIndex => scene.buildIndex;
34+
public int buildIndex => SceneUtility.GetBuildIndexByScenePath(_scenePath);
3735

3836

3937
public void LoadScene(LoadSceneMode mode = LoadSceneMode.Single)

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jutils",
33
"displayName": "JUtils",
4-
"version": "1.10.2",
4+
"version": "1.10.3",
55
"description": "A unity utilities library, this contains many handy extensions, components and data structures with custom editors",
66
"license": "LGPL-3.0",
77
"author": {

0 commit comments

Comments
 (0)
Please sign in to comment.