Skip to content

Commit e402b65

Browse files
committed
Fix templatePath
1 parent 41dbab5 commit e402b65

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Assets/FishNet/Runtime/Editor/NewNetworkBehaviour/CreateNewNetworkBehaviour.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@ internal sealed class CreateNewNetworkBehaviour : MonoBehaviour
1616
[MenuItem("Assets/Create/NetworkBehaviour Script", false, -220)]
1717
private static void CreateNewAsset()
1818
{
19-
string templatePath;
20-
if (Directory.Exists(Application.dataPath + "/FishNet"))
21-
{
22-
templatePath = Application.dataPath + "/FishNet/Assets/FishNet/Runtime/Editor/NewNetworkBehaviour/template.txt";
23-
}
24-
else
25-
{
26-
templatePath = "Packages/com.firstgeargames.fishnet/Runtime/Editor/NewNetworkBehaviour/template.txt";
27-
}
28-
19+
string templatePath = Application.dataPath + "/FishnetNBTemplate.txt";
2920
if (!File.Exists(templatePath))
3021
{
3122

Assets/FishNet/Runtime/Editor/NewNetworkBehaviour/SettingsProvider.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using UnitySettingsProvider = UnityEditor.SettingsProvider;
88
using FishNet.Configuring;
99
using System.IO;
10+
using System.Xml.Linq;
1011

1112

1213
namespace FishNet.Editing.NewNetworkBehaviourScript
@@ -16,8 +17,7 @@ internal static class SettingsProvider
1617

1718

1819
private static PrefabGeneratorConfigurations _settings;
19-
static string templatePath = Application.dataPath + "/FishNet/Assets/FishNet/Runtime/Editor/NewNetworkBehaviour/template.txt";
20-
20+
static string templatePath;
2121
[UnitySettingsProvider]
2222
private static UnitySettingsProvider Create()
2323
{
@@ -39,14 +39,19 @@ private static UnitySettingsProvider Create()
3939

4040
private static void OnGUI(string searchContext)
4141
{
42-
if(GUILayout.Button("Edit template"))
42+
if(templatePath == null) templatePath = Application.dataPath + "/FishnetNBTemplate.txt";
43+
44+
if (GUILayout.Button("Edit template"))
4345
{
4446
if (!File.Exists(templatePath))
4547
{
4648
CreateNewNetworkBehaviour.CopyExistingTemplate(templatePath);
4749
}
4850
System.Diagnostics.Process.Start(templatePath);
4951
}
52+
53+
EditorGUILayout.LabelField($"Template path: {templatePath}");
54+
5055
}
5156

5257

0 commit comments

Comments
 (0)