#GetName can only be called from the main thread

1 messages · Page 1 of 1 (latest)

patent hollow
#

Hello, I have an issue with my Scriptable Object. Whenever I select it, the inspector has issues (check screenshot) and I get multiple exceptions:

Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.```
```ArgumentException: An item with the same key has already been added. Key: 6291459```
```NullReferenceException: Object reference not set to an instance of an object```
All these exceptions are not raised by my code and I already cleaned the Library folder. Everything is up to date and I get the issue with the LTS version and latest 6000.2 version

Here is my code:
```using UnityEngine;

[CreateAssetMenu(fileName = "New Game Event", menuName = "Game Event")]
public class GameEvent : ScriptableObject
{
    public string actor;
    public string text;
    public bool hasChoices;
    public Choice[] choices;
}```

```[System.Serializable]
public struct Choice
{
    public string text;
    public float publicOpinionChange;
    public float treasuryChange;
    public float stabilityChange;
    public float godFavorChange;
    public float secrecyChange;
    public string[] flagsToAdd;
    public string[] requiredFlags;
}
untold flax
#

this is a known bug on 6.2
normally the LTS doesn't. You can try earlier version

patent hollow
#

Hmm ok latest LTS has the issue too then

untold flax
#

try a few patches versions earlier and see

patent hollow
#

will do that then