Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Scripting define symbols empty

Discussion in 'Editor & General Support' started by pinkehelga, Jun 26, 2022.

  1. pinkehelga

    pinkehelga

    Joined:
    Jun 23, 2022
    Posts:
    3
    I'm working on Unity 2022.1.4f1 (Ubuntu Linux). When I try to define symbols in the project/player settings, they are actually written into the project settings asset and the .csproj file.
    However, after Unity recompiles scripts, all the entries are removed from the list, both, symbols and compiler arguments.

    I accidently added a symbol as an entry to the arguments list and Unity failed to compile. I had no chance to remove the entry from the list in Unity.
    I also tried to reimport all and regenerate project files without success.

    Therefore I had to close Unity editor, search all occurrences in the project folder using the IDE and remove the compiler arguments manually.

    Why could this happen? Do I have any chance to manage symbols and compiler arguments from the Unity editor?
     
    Last edited: Jun 26, 2022
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,717
    Not so sure about compiler arguments but for script defines, that should be the only place you manage it from.

    Make a blank project, try it there. We know it works.

    It could fail for various reasons, such as a rogue editor script running and removing all those defines.

    Either way, please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    Here's how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally setting Unity up (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards
     
  3. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    753
    Kurt-Dekker likes this.
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,717
    ALSO: when you type a define symbol in the box in Player Settings, make sure you press ENTER!!!!

    Failure to press ENTER will simply cause Unity to drop the change(s).
     
  5. pinkehelga

    pinkehelga

    Joined:
    Jun 23, 2022
    Posts:
    3
    MousePods likes this.
  6. pinkehelga

    pinkehelga

    Joined:
    Jun 23, 2022
    Posts:
    3
    Adding symbols actually works behind the scenes. The only thing is, the are removed from the list in the Editor GUI. Thus removing them manually in Rider is the only chance to get rid of them.
     
  7. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    i can't change the define symbols in android, they keep going back to their desktop settings now
     
  8. AndreusNvidius

    AndreusNvidius

    Joined:
    May 17, 2022
    Posts:
    3
    So, I'm getting a mismatch between what's in the ProjectSettings.asset file and what's showing up in the Editor.

    Currently on 2022.1.13f1. I know it's old, but I haven't heard of an editor that has fixed this and I'm not changing versions if I don't know it will fix my problem.
     
    simondesc11 and AldeRoberge like this.