#Custom [Preserve] attribute
1 messages · Page 1 of 1 (latest)
Example:
[PreserveAttributeTargets]
public class RunOnGameInitializationAttribute : Attribute { }```
for the IDE usages, i'm pretty sure MeansImplicitUse is what you need, it's one of the Jetbrains annotations included with Unity
according to the docs you can define your own preserve attribute too, but it has to be named PreserveAttribute so i guess you're out of luck if you want a nicer name
Thanks for the anwser. Sadly MeansImplicitUse only works with jetbrains and not with Visual Studio. I found a possible solution in the meantime though: It seams that the preserve part might be possible with an ILPostProcessor, which basicaly appends the code with Unity's Preserve attribute when compiled, but I don't realy know how to do it yet.
ah, it's been many years since i've touched VS without resharper installed 😄