Modify Built-In Class Variables Get/Set functions

Hello,

I was wondering whether it might be possible to change the Get/Set functions of variables of built-in unity classes. More precisely I want to change the get/set properties of Text components to easily implement language localisation.

If I go to the declaration of the Text component I get the following:

using System;

namespace UnityEngine.UI
{
	[AddComponentMenu ("UI/Text", 10)]
	public class Text : MaskableGraphic, ILayoutElement
	{
		public virtual string text {
			get;
			set;
		}

So the way I see it, I should be able to modify the get part to smth like this:

get{LocalizationScript.Localize(value)}

But practically Visual Studio does not let me edit those variables. Therefore I was wondering if someone has any suggestions on how to do that (I would like to avoid Extension Methods).

Thanks, Fred

Since the property is virtual, you can override it in a class that derives Text:

using UnityEngine.UI;
    
public class LocalizedText : Text {
    public override string text {
        get { return LocalizationScript.Localize(base.text); }
        set { base.text = value; }
}