The add on make unity editor unresponsive.

Created at
Updated at

Hello,

I have tested writing an add-on following the instructions from the page below: https://rpgmakerunite.com/en/learn/013_eng.html#03a

When I enable the add-on, it causes the Unity Editor to become unstable and completely unresponsive. The UI elements break, making it impossible to click or continue working.

Is this a bug, or did I do something wrong? Please provide guidance.

RPG Maker Version: 1.2 Unity Version: 2021.3.28

The error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object   at RPGMaker.Codebase.Runtime.Addon.AddonManager.InstantiateAddons () [0x00087] in G:\unityProj2\2021LTs28_RMU2\Assets\RPGMaker\Codebase\Runtime\Addon\Service\AddonManager.cs:1931    at RPGMaker.Codebase.Runtime.Addon.AddonManager.Refresh () [0x00054] in G:\unityProj2\2021LTs28_RMU2\Assets\RPGMaker\Codebase\Runtime\Addon\Service\AddonManager.cs:240    at RPGMaker.Codebase.Editor.Common.RpgMakerEditor.InitializeOnLoad () [0x00059] in G:\unityProj2\2021LTs28_RMU2\Assets\RPGMaker\Codebase\Editor\Common\RpgMakerEditor.cs:114    at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <6d53f1ee8ee746e4b3c819c68e33f296>:0     --- End of inner exception stack trace ---   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <6d53f1ee8ee746e4b3c819c68e33f296>:0    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <6d53f1ee8ee746e4b3c819c68e33f296>:0    at UnityEditor.EditorAssemblies.ProcessInitializeOnLoadMethodAttributes () [0x000a5] in <308d48a21a3e462ba091bd758b25b1e6>:0  UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()

01_JKFDVSXHMTHTGHH_65_QG_7_WCFB_9ff4e6c95f

code:

/*:

* @addondesc Turns Self Switch ON

* @author Author

* @help Turns a particular Self Switch ON/OFF

* @command SetSelfSwitchValue

*      @text Change Self Switch

*      @desc Assigns a value to Self Switch.

*  @arg SelfSwitch

*      @text Self Switch

*      @desc Specify Self Switch

*      @type select

*      @option A

*      @option B

*      @option C

*      @option D

*      @default A

*  @arg Value

*      @text Setting Value

*      @desc Specify Self Switch value

*      @type boolean 

*/

/*:ja

*/

using System.Collections.Generic;

using RPGMaker.Codebase.CoreSystem.Knowledge.DataModel.Runtime;

using RPGMaker.Codebase.Runtime.Addon;

using RPGMaker.Codebase.Runtime.Common;

namespace RPGMaker.Codebase.Addon {

public class MyAddOnSample {

public void SetSelfSwitchValue(int selectSelfSwitch, bool selectValue){

var eventId = AddonManager.Instance.GetCurrentEventId();

var saveDataModel = DataManager.Self().GetRuntimeSaveDataModel();

var selfSwitchData = saveDataModel.selfSwitches.Find(selfSwitch => selfSwitch.id == eventId);

if (selfSwitchData == null){

selfSwitchData = new RuntimeSaveDataModel.SaveDataSelfSwitchesData();

selfSwitchData.id = eventId;

selfSwitchData.data = new List<bool>() { false, false, false, false };

saveDataModel.selfSwitches.Add(selfSwitchData);

}

selfSwitchData.data[selectSelfSwitch] = selectValue;

}

}

}

Comments

Created at
Updated at

I was able to replicate this issue so I'll get this reported. If you didn't fix it already, you can follow this video below to at least stop the frozen project.

  1. Exit project
  2. Delete the folder and meta files associated with plugin. In this below case I named the addon test.cs so I needed to delete the test folder and test.meta. These will be found in the projects Assets\RPGMaker\Codebase\Add-ons directory.
01_JKKPTWBPFP_89_ZEEDPC_2_DWE_13_69f868b5c2

Created at

Thank you very much, Baz! After deleting the folders and files as you recommended, the editor is now working again.

I would like to understand the cause of the error.

Is it a system bug, a mistake in my code, or a bug specific to version 1.2?

Did the previous versions have the same bug? And where can I download them?


Created at

I have discovered another bug related to changing certain fonts that support the Thai language. I'm not sure if this also affects other foreign languages. It causes the project to fail to build permanently. Even if the font is reverted to the original one, the build still fails.


Created at

Can you reproduce the font issue in any project? If so, can you please give us the steps to reproduce?


Created at

I created a new project and tried changing the language to Thai font. Strangely, the build was successful.

It might be because, in the project that failed to build, I attempted to add the "Arundina" font by installing it. However, the editor didn't recognize this font. So, I modified the fontmanager.cs file to manually add the font name to the list and placed the font in Assets/TextMesh Pro/Fonts. This may have caused the system to become permanently unstable.

When creating a new project, I found a way to make the "Arundina" font appear in the list by adding it to the folder: D:\2021.3.28f1\Editor\Data\Resources\Fonts

I installed the Unity Editor there, and after doing so, I was able to use the font successfully. I think some functions related to reading font names might have issues because I see incomplete font names in the list, as shown in the image.

01_JKXBSEXQQC_65_STHK_5_JD_5_N4_RT_8693731631

Created at

These below steps may resolve the issue:

 

1. Select Window - AssetManagement - Addressables - Groups:

01_JKXGQTE_9_Y41_H4_DY_23_RGSVYTB_89001e9bfc

 

2. Click Create Addressables Settings button:

01_JKXGRYFM_9_XZ_63_H0_MC_1_JHEE_8_P_c797cca28f

Created at

Can you give us specific fonts that are trying to be used so we can replicate this?


Created at

You can download this font from the following link: https://www.f0nt.com/release/arundina-by-sipa/

However, the fix I mentioned earlier only resolves the issue in the editor. When building the project, the displayed text changes to a different font, which I assume is RMU's default font.

Even after setting the font file as addressable as you recommended, the issue remains unresolved.

But I found a way to make the selected font display correctly in the build. By setting the Title, Message, and Message_Name fonts in the Inspector so that the font list contains only one font, it displays correctly, as shown in the attached image.

01_JM_1_QEGT_0_MEMYMXP_7_SHNSN_341_bb8bd878e0

01_JM_1_QDB_8_JF_63_BR_7_AQ_0_ZD_5_BHKF_a93639e44f
01_JM_1_QFB_0_YKB_2_D9_TGYHEWK_2_V4_S_eb553b7414
01_JM_1_QFXDVA_3_FMSHC_2_HEDYECDH_59291aaf03