Cache file generation
You can generate the prebuild content in another file. All regions are generate in the defined file with namespace and usings. It just require a namespace and a partial class.
Define the target file in a Prebuild Attribute
.
using System;
using System.IO;
using UnityEngine;
namespace EODE.Wonderland._example {
public class ExtExamplePack : PrebuildPackage {
public Type[] Attributes {
get {
return new Type[] {
typeof(ExtExampleAttribute)
};
}
}
}
public class ExtExamplePrebuildAttribute : PrebuildAttribute {
public ExtExamplePrebuildAttribute() : base(typeof(ExtExamplePack)) {
ExternalFilePath = Path.Combine(Application.dataPath, "Game", "ExtExampleCache.cs");
}
}
}
Example:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace EODE.Wonderland._example {
[ExtExamplePrebuild]
public partial class MyExtExample {
[ExtExample]
void WorldTest() { }
}
}
Generated script Assets/Game/ExtExampleCache.cs
with 2 examples:
#region EODE.Wonderland._example.MyExtExample
namespace EODE.Wonderland._example {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public partial class MyExtExample {
private void HelloExtWorldTest() {
Debug.Log("Hello Prebuild");
Debug.Log("test");
}
}}
#endregion
#region EODE.Wonderland._example.MyExtExample2
namespace EODE.Wonderland._example {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public partial class MyExtExample2 {
private void HelloExtWorldTest() {
Debug.Log("Hello Prebuild");
Debug.Log("test");
}
}}
#endregion