question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Any way to make this work with Odin?

See original GitHub issue

Hey, Thanks for making this!

I’m having trouble with this step in the installation instructions: “Alternatively, you can apply MarkedUpEditor to all classes that inherit from MonoBehaviour or ScriptableObject and don’t have their own custom editor:”

[CustomEditor(typeof(MonoBehaviour), true), CanEditMultipleObjects]
internal class MarkedUpMonoBehaviourEditor : MarkedUpEditor
{
}
[CustomEditor(typeof(ScriptableObject), true), CanEditMultipleObjects]
internal class MarkedUpScriptableObjectEditor : MarkedUpEditor
{
}

I tried putting this in an editor script, but I still can’t use markup attributes in my monobehaviours. For example, even if I tag a field as ReadOnly, it still displays as a normal editable field.

Meanwhile, I tried applying the script to a single class, and it worked. Like this:

[CustomEditor(typeof(LockedDoor)), CanEditMultipleObjects]
internal class LockedDoorEditor : MarkedUpEditor
{
}

In the LockedDoor class, I have a field that looks like this [SerializeField, ReadOnly] bool canBeRelocked = false;

Using the second example, the ReadOnly attribute works as expected.

After a quick test in an empty project, it seems that this problems only occurs when Odin is present in the project (even if Sirenix is not implemented in that particular script). Is there any way this asset can work with Odin in the project without having to create a separate MarkedUpEditor class for every component that I want to use it with? I’m interested in Odin alternatives, but my project isn’t prepared to just remove it outright.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gasgiantcommented, Nov 30, 2021

MarkupAttributes doesn’t change anything about Unity serialization. It’s a purely UI package. And it only applies its inspector to a class if you tell it to do so. You can tell it to aplly its inspector to all MonoBehaviours and SerializedObjects, as described in the Usage part of the readme. Odin has something like this in its codebase by default.

0reactions
3ternalcommented, Nov 30, 2021

Got it; thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Odin: 9 Ways to Work With the Norse Germanic AllFather
1. Sacrifice · 2. Dedicate Altar Space to Odin · 3. Altar Offerings for Odin · 4. The Number 9 · 5. Odin's...
Read more >
Working With The Gods: Odin | Whispers of Yggdrasil
For the spiritual work with Odin, it is a good thing to have at hand some kind of alcoholic beverage, it can be...
Read more >
Working with Odin: Offerings, Herbs, Crystals & More
There are many ways to work with Odin. The first and best way to begin connecting to any deity is to do your...
Read more >
Connecting with Odin
When Odin wants to work with someone there's usually plenty of not-so-subtle signs. Today's post is all about connecting with Odin!
Read more >
Odin Emulation Set-Up Guide : r/OdinHandheld
The best way to store PSP roms is to convert your .iso files into .cso files using ISO Compressor (Don't do this for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found