com.warwlock.mtree 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ {
2
+ "git": {
3
+ "commitMessage": "Release v${version}",
4
+ "tagName": "v${version}"
5
+ },
6
+ "github": {
7
+ "release": true,
8
+ "releaseName": "v${version}",
9
+ "tokenRef": "GITHUB_TOKEN"
10
+ },
11
+ "npm": {
12
+ "publish": true
13
+ }
14
+ }
package/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@ All notable changes to this package will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## \[1.0.5] - 2025-11-22
8
+
9
+ ### Fixed
10
+ - Unity 6 "FindObjectByType" warnings were fixed.
11
+ - Removed some of old Unity version support codes.
12
+
13
+ ## \[1.0.4] - 2025-11-22
14
+
15
+ ### Removed
16
+ - Scene creator code removed.
17
+
18
+ ## \[1.0.2] and [1.0.3] - 2025-11-22
19
+
20
+ - Release-it tests.
21
+
7
22
  ## \[1.0.1] - 2025-11-20
8
23
 
9
24
  ### Fixed
@@ -24,38 +24,39 @@ namespace Mtree
24
24
  if (instance.GetComponent<MtreeComponent>() == null)
25
25
  return;
26
26
 
27
- #if UNITY_2018_3_OR_NEWER
28
27
  string prefabPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(instance);
29
- #else
30
- string prefabPath = AssetDatabase.GetAssetPath(PrefabUtility.GetPrefabParent(instance));
31
- #endif
32
- MtreeComponent[] trees = (MtreeComponent[])GameObject.FindObjectsOfType(typeof(MtreeComponent));
28
+ MtreeComponent[] trees =
29
+ #if UNITY_6000_0_OR_NEWER
30
+ (MtreeComponent[])GameObject.FindObjectsByType(typeof(MtreeComponent), FindObjectsSortMode.None);
31
+ #else
32
+ (MtreeComponent[])GameObject.FindObjectsOfType(typeof(MtreeComponent));
33
+ #endif
33
34
  MtreeComponent originTree = null;
34
35
  foreach (MtreeComponent tree in trees)
35
36
  {
36
- #if UNITY_2018_3_OR_NEWER
37
+ #if UNITY_2018_3_OR_NEWER
37
38
  bool isInstance = PrefabUtility.GetPrefabInstanceStatus(tree) == PrefabInstanceStatus.Connected;
38
39
  string parentPrefabPath = AssetDatabase.GetAssetPath(PrefabUtility.GetCorrespondingObjectFromSource(tree));
39
- #else
40
+ #else
40
41
  bool isInstance = PrefabUtility.GetPrefabType(tree) == PrefabType.PrefabInstance;
41
42
  string parentPrefabPath = AssetDatabase.GetAssetPath(PrefabUtility.GetPrefabParent(tree));
42
- #endif
43
+ #endif
43
44
  if (isInstance && parentPrefabPath == prefabPath)
44
45
  {
45
- #if UNITY_2018_3_OR_NEWER
46
+ #if UNITY_2018_3_OR_NEWER
46
47
  PrefabUtility.UnpackPrefabInstance(tree.gameObject, PrefabUnpackMode.Completely, InteractionMode.AutomatedAction);
47
- #else
48
+ #else
48
49
  PrefabUtility.DisconnectPrefabInstance(tree);
49
- #endif
50
+ #endif
50
51
  originTree = tree;
51
52
  }
52
53
  }
53
54
 
54
55
 
55
- #if UNITY_2018_3_OR_NEWER // Unity 2017 crashes when deleting prefab at this stage. This part is therefore also done in the MtreeComponent editor
56
+ #if UNITY_2018_3_OR_NEWER // Unity 2017 crashes when deleting prefab at this stage. This part is therefore also done in the MtreeComponent editor
56
57
  AssetDatabase.DeleteAsset(prefabPath);
57
58
  AssetDatabase.Refresh();
58
- #endif
59
+ #endif
59
60
 
60
61
  if (originTree == null)
61
62
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "com.warwlock.mtree",
3
3
  "displayName": "MTree",
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "45f2",
7
7
  "description": "A powerful procedural tree creation tool for Unity. Now it is completely Open Source (MIT).",
@@ -26,12 +26,6 @@
26
26
  "dependencies": {
27
27
  "com.unity.shadergraph": "12.1.16"
28
28
  },
29
- "git": {
30
- "tagName": "v${version}"
31
- },
32
- "github": {
33
- "release": true
34
- },
35
29
  "samples": [
36
30
  {
37
31
  "displayName": "Example Templates",
@@ -1,165 +0,0 @@
1
- 
2
- using System.Collections;
3
- using System.Collections.Generic;
4
- using UnityEngine;
5
- using UnityEngine.Rendering;
6
- using Mtree;
7
- [ExecuteInEditMode]
8
- public class ExampleSceneManager : MonoBehaviour
9
- {
10
- List<Material> BarkMaterials,LeafMaterials;
11
- Material Floor;
12
- GameObject Trees,PostProcessing;
13
- bool Setup = true;
14
-
15
- void PostProcessActive()
16
- {
17
- #if UNITY_POST_PROCESSING_STACK_V2
18
-
19
- #if UNITY_2019_3_OR_NEWER
20
-
21
- if( Utils.GetCurrentPipeline() == "legacy"){
22
- PostProcessing = Instantiate(Resources.Load("Mtree/Examples/Post Processing") as GameObject,this.transform);
23
- PostProcessing.name = "Post Processing";
24
- PostProcessing.layer = 8;
25
- var cam = GetComponentInChildren<Camera>().gameObject;
26
- cam.layer = 1;
27
-
28
- var PPlayer = cam.GetComponent<UnityEngine.Rendering.PostProcessing.PostProcessLayer>();
29
- if(PPlayer == null)
30
- cam.AddComponent<UnityEngine.Rendering.PostProcessing.PostProcessLayer>();
31
-
32
- PPlayer.antialiasingMode = UnityEngine.Rendering.PostProcessing.PostProcessLayer.Antialiasing.FastApproximateAntialiasing;
33
- PPlayer.volumeLayer = 2;
34
- PostProcessing.transform.SetParent(this.transform);
35
- }
36
- #else
37
- PostProcessing = Instantiate(Resources.Load("Mtree/Examples/Post Processing") as GameObject,this.transform);
38
- PostProcessing.name = "Post Processing";
39
- PostProcessing.layer = 8;
40
- var cam = GetComponentInChildren<Camera>().gameObject;
41
- cam.layer = 1;
42
-
43
- var PPlayer = cam.GetComponent<UnityEngine.Rendering.PostProcessing.PostProcessLayer>();
44
- if(PPlayer == null)
45
- cam.AddComponent<UnityEngine.Rendering.PostProcessing.PostProcessLayer>();
46
-
47
- PPlayer.antialiasingMode = UnityEngine.Rendering.PostProcessing.PostProcessLayer.Antialiasing.FastApproximateAntialiasing;
48
- PPlayer.volumeLayer.value = 2;
49
- PostProcessing.transform.SetParent(this.transform);
50
- #endif
51
- #endif
52
-
53
- }
54
- void LegacySetup(){
55
- #if UNITY_2019_1_OR_NEWER
56
- var obj = Instantiate(Resources.Load("Mtree/Examples/2019_1 Legacy") as GameObject,this.transform);
57
- obj.name = "Legacy 2019.1+";
58
- Debug.Log("Legacy 2019.1+ Scene loaded!");
59
- #else
60
- var obj = Instantiate(Resources.Load("Mtree/Examples/2017_4 Legacy") as GameObject,this.transform);
61
- obj.name = "Legacy 2017.4+";
62
- Debug.Log("Legacy 2017.4+ was loaded!");
63
- #endif
64
- }
65
- void LWRPSetup()
66
- {
67
- #if UNITY_2018_3_OR_NEWER
68
- var obj = Instantiate(Resources.Load("Mtree/Examples/2018_4 LWRP") as GameObject,this.transform);
69
- obj.name = "LWRP 2018.4+";
70
- Debug.Log("LWRP 2018.4+ Scene loaded!");
71
- #endif
72
- }
73
-
74
- void HDRPSetup()
75
- {
76
-
77
- #if UNITY_2019_3_OR_NEWER
78
- var obj = Instantiate(Resources.Load("Mtree/Examples/2019_3 HDRP") as GameObject,this.transform);
79
- obj.name = "HDRP 2019.3+";
80
- Debug.Log("HDRP 2019.3+ Scene loaded!");
81
- #else
82
- var obj = Instantiate(Resources.Load("Mtree/Examples/2018_4 HDRP") as GameObject,this.transform);
83
- obj.name = "HDRP 2018.4+";
84
- Debug.Log("HDRP 2018.4+ Scene loaded!");
85
- #endif
86
- }
87
- void URPSetup()
88
- {
89
- #if UNITY_2019_3_OR_NEWER
90
- Instantiate(Resources.Load("Mtree/Examples/2019_3 URP") as GameObject,this.transform);
91
- Debug.Log("URP 2019.3+ Scene loaded!");
92
- #endif
93
- }
94
- void Start()
95
- {
96
-
97
- if(Setup){
98
- foreach(Transform t in this.transform)
99
- DestroyImmediate(t.gameObject);
100
- switch(Utils.GetCurrentPipeline())
101
- {
102
- case "legacy":
103
- LegacySetup();
104
- break;
105
-
106
- case "lwrp":
107
- LWRPSetup();
108
- break;
109
-
110
- case "hdrp":
111
- HDRPSetup();
112
- break;
113
-
114
- case "urp":
115
- URPSetup();
116
- break;
117
- }
118
- PostProcessActive();
119
- UpdateMaterials();
120
- Setup = false;
121
- }
122
- }
123
- void UpdateMaterials(){
124
-
125
- BarkMaterials = new List<Material>();
126
- LeafMaterials = new List<Material>();
127
- var renderers = GameObject.Find("Trees").GetComponentsInChildren<MeshRenderer>();
128
- Floor = transform.GetComponent<MeshRenderer>().sharedMaterial;
129
- foreach (var r in renderers){
130
- foreach(var m in r.sharedMaterials){
131
- if(m.shader.name.Contains("Leafs"))
132
- LeafMaterials.Add(m);
133
- if(m.shader.name.Contains("Bark"))
134
- BarkMaterials.Add(m);
135
- }
136
- }
137
-
138
- for(int i = 0; i<BarkMaterials.Count;i++)
139
- BarkMaterials[i].shader = Utils.GetBarkShader();
140
- for(int i = 0; i<LeafMaterials.Count;i++)
141
- LeafMaterials[i].shader = Utils.GetLeafShader();
142
-
143
- switch(Utils.GetCurrentPipeline())
144
- {
145
- case "legacy":
146
- Floor.shader = Shader.Find("Standard");
147
- break;
148
-
149
- case "lwrp":
150
- Floor.shader = Shader.Find("Lightweight Render Pipeline/Lit");
151
- break;
152
-
153
- case "hdrp":
154
- Floor.shader = Shader.Find("HDRP/Lit");
155
- break;
156
-
157
- case "urp":
158
- Floor.shader = Shader.Find("Universal Render Pipeline/Lit");
159
- break;
160
- }
161
-
162
-
163
-
164
- }
165
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: aa67cce4c67a3c7499aff4ef4ff8ce8a
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant: