Skip to content

Commit 58c862d

Browse files
committed
update examples
1 parent 5127d34 commit 58c862d

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

Assets/Editor/UIPanelEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void OnSceneGUI()
135135

136136
Vector3 pos = panel.GetUIWorldPosition();
137137
float sizeFactor = HandleUtility.GetHandleSize(pos);
138-
#if UNITY_2019_1_OR_NEWER
138+
#if UNITY_2022_2_OR_NEWER
139139
Vector3 newPos = Handles.FreeMoveHandle(pos, sizeFactor, Vector3.one, Handles.ArrowHandleCap);
140140
#elif UNITY_2017_1_OR_NEWER
141141
Vector3 newPos = Handles.FreeMoveHandle(pos, Quaternion.identity, sizeFactor, Vector3.one, Handles.ArrowHandleCap);

Assets/Examples/BundleUsage/BundleUsageMain.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using FairyGUI;
44
using System.Net;
55
using UnityEngine.Networking;
6+
using System;
67

78
/// <summary>
89
/// Demonstrated how to load UI package from assetbundle. The bundle can be build from the Window Menu->Build FairyGUI example bundles.
@@ -23,8 +24,12 @@ void Start()
2324
IEnumerator LoadUIPackage()
2425
{
2526
string url = Application.streamingAssetsPath.Replace("\\", "/") + "/fairygui-examples/bundleusage.ab";
26-
if (Application.platform != RuntimePlatform.Android)
27-
url = "file:///" + url;
27+
if (Application.isEditor)
28+
{
29+
UriBuilder uri = new UriBuilder(url);
30+
uri.Scheme = "file";
31+
url = uri.ToString();
32+
}
2833

2934
#if UNITY_2017_2_OR_NEWER
3035

Assets/Examples/Editor/BuildAssetBundles.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ public class BuildAssetBundles
77
[MenuItem("Window/Build FairyGUI Example Bundles")]
88
public static void Build()
99
{
10-
string basePath = "Assets/FairyGUI/Examples/Resources/";
11-
if (AssetImporter.GetAtPath(basePath + "Icons/i0.png") == null)
12-
basePath = "Assets/Examples/Resources/";
10+
string testPath = "UI/BundleUsage_fui";
11+
Object obj = Resources.Load(testPath);
12+
string path = AssetDatabase.GetAssetPath(obj);
13+
if(string.IsNullOrEmpty(path))
14+
{
15+
Debug.LogWarning("sample not found: " + testPath);
16+
return;
17+
}
18+
string basePath = path.Substring(0, path.Length - testPath.Length - 6);
1319

1420
for (int i = 0; i < 10; i++)
1521
{
@@ -22,6 +28,6 @@ public static void Build()
2228
if (!Directory.Exists(Application.streamingAssetsPath))
2329
Directory.CreateDirectory(Application.streamingAssetsPath);
2430

25-
BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.None, BuildTarget.Android);
31+
BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
2632
}
2733
}

0 commit comments

Comments
 (0)