iOS Build Error - type or namepace 'MenuCommand', 'MenuItemAttribute', 'MenuItem' not found

From this project, I have taken 2 files to add support for multiple languages within my project and especially to deal with Chinese, Japanese, and Hebrew languages.

From this Open-Project I have taken these 2 files:

LocalizationComponent_TMProFont, LocalizeTMProFontEvent - these 2 files I have used within my project.
7003697--827960--localization files.png

All thing was working properly, up to I started exporting a project for an iOS build.
It on the spot gave me the following errors within Unity Error:

If you notice, I placed both scripts out of Editor folder because if I put it within the Editor folder then it was not detected by Unity Inspector.
After I put them outside the Editor folder it started working properly within Unity Editor.

Please give me some guidance on this so I can generate an iOS platform build.

What does your script look like? Looks like you are using editor only code. You may need to put it inside of an #if UNITY_EDITOR

I have dragged these 2 scripts within the project:

Which code do I need to place inside #if UNITY_EDITOR tag?

The first script is an editor only script and should be placed into an editor only assembly or put the whole thing inside of an if UNITY_EDITOR

I have placed both scripts within UNITY_EDITOR tag and after this, I can able to export a build for the iOS project.
If I just add UNITY_EDITOR tag within the first script then also Addressable, I can’t able to build it, it showing me errors.

Both scripts I am attaching to this post so please check this.

This type of error I was getting when I was running the build within the actual iPhone device:

Because of this, Font Assets files are not changing runtime so it can’t able to display other language content like Chinese, Japanese etc…, I have downloaded special fonts and created Font Assets SDF files.

So please give me some help with this :slight_smile:

7004711–828146–LocalizeComponent_TMProFont.cs (2.56 KB)
7004711–828149–LocalizeTMProFontEvent.cs (1.51 KB)

Just the first script. The one that is inside of UnityEditor namespace. Don’t do it to the 2nd script, the one in the UnityEngine namespace.

But this doesn’t allow me to build Addressables Group and at build time, I am getting these errors:

What to do about this?

LocalizeComponent_TMProFont.cs
This is an editor only script.
The other script should always be included. If you always include it then you won’t get that error. Remove the if UNITY_EDITOR from the non editor script

Yes, sir, this change is done.
Please check the attached files.

This is how I placed both files within the project:
7004741--828170--localization scripts.png

7004711–828146–LocalizeComponent_TMProFont.cs (2.56 KB)
7004741–828164–LocalizeTMProFontEvent.cs (1.48 KB)

That looks correct. Does it work?

As I told you above, it gave me these errors when I try to build an Addressables Group:

Oh I see. You need to put the Reset method inside a UNITY_EDITOR

1 Like

Everything started working fine :slight_smile:
iOS build gets exported and multiple languages working too.

Now whichever Dynamic Font Assets, I have created that taking some time to load and display the exact content.
So at starting the text component remains blank and then after sometime text becomes visible so the overall experience getting weird - any solution you have thought of for this?

You could try marking the tables as preload. Theres going to be delays switching languages as it needs to load the various asset bundles. We have a Sample called Preloading which shows how to show a loading screen for this.

1 Like