# Best way to make a variable editable in editor and accessible in code, including when not in game

**URL:** <https://forums.unrealengine.com/t/best-way-to-make-a-variable-editable-in-editor-and-accessible-in-code-including-when-not-in-game/135893>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [January 4, 2020, 11:47am UTC](https://forums.unrealengine.com/t/best-way-to-make-a-variable-editable-in-editor-and-accessible-in-code-including-when-not-in-game/135893 "2020-01-04T11:47:23Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![caleb.tenebrous](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@caleb.tenebrous](https://forums.unrealengine.com/u/caleb.tenebrous)\
**Post date:** [January 4, 2020, 1:50pm UTC](https://forums.unrealengine.com/t/best-way-to-make-a-variable-editable-in-editor-and-accessible-in-code-including-when-not-in-game/135893/4 "2020-01-04T13:50:11Z")

</div>

I’m still interested to see if anyone has any thoughts on this, but for the time being I seem to have found a potential solution.

Following the amazing here:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

With additional context here:

[https://forums.unrealengine.com/development-discussion/c-gameplay-programming/102665-question-about-global-singleton](https://forums.unrealengine.com/development-discussion/c-gameplay-programming/102665-question-about-global-singleton)

I was able to create a blueprint singleton class that I can set defaults on and already exists in editor when anything might want to access it.

For more context, in my new singleton, I have two variables so far: TextureTiling and UVSize.  
TextureTiling is set to 16 in the constructor (but can also be edited in BP through EditDefaultsOnly) and UVSize is set in PostInitProperties.

The singleton is accessed in editor during OnComponentCreated - which is fine because the singleton instance already exists.

And of course it also works fine in game too.

---

_[View the full topic](https://forums.unrealengine.com/t/best-way-to-make-a-variable-editable-in-editor-and-accessible-in-code-including-when-not-in-game/135893)._
