For this behaviour should I use class or structure?

I’ve made both and I need your opinion witch one you would prefer using and why?

First I did structure I love them

using UnityEngine;
using System.Collections;

public struct MenuLabels {
	/// Changes Both Min&Max changes dinamically
	public static void DinamicHorizontalSliderF(string Name, ref float Value, ref float SliderMinValue, ref float SliderMaxValue, float GuiWidth){
		GUILayout.BeginHorizontal();
		GUILayout.Label(Name + Value);
		
		HorizontalSlider(ref Value, SliderMinValue, SliderMaxValue, GuiWidth);
		
		GUILayout.EndHorizontal();
		
		ChangeMinSlider(Value, ref SliderMinValue);
		ChangeMaxSlider(Value, ref SliderMaxValue);
	}
	/// Changes from MinValue to dinamic MaxValue
	public static void DinamicPositiveHorizontalSliderF(string Name, ref float Value, float SliderMinValue, ref float SliderMaxValue, float GuiWidth){
		GUILayout.BeginHorizontal();
		GUILayout.Label(Name + Value);
		
		HorizontalSlider(ref Value, SliderMinValue, SliderMaxValue, GuiWidth);
		
		GUILayout.EndHorizontal();
		
		ChangeMaxSlider(Value, ref SliderMaxValue);
	}
	private static void HorizontalSlider(ref float Value, float SliderMinValue, float SliderMaxValue, float GuiWidth){
		Value = GUILayout.HorizontalScrollbar((Value), 0.01f, SliderMinValue, SliderMaxValue, GUILayout.Width(50) );
	}
	private static void ChangeMinSlider(float Value, ref float SliderMinValue){
		if (SliderMinValue >= Value){
			SliderMinValue --;
		}
		else if (SliderMinValue <= Value-5){
			SliderMinValue ++;
		}
	}
	private static void ChangeMaxSlider(float Value, ref float SliderMaxValue){
		if (SliderMaxValue <= Value+1){
			SliderMaxValue ++;
		}
		else if (SliderMaxValue >= Value+6){
			SliderMaxValue --;
		}
	}
	
}

Called with:

using System;
using UnityEngine;
using System.Collections;

public class MainMenu : MonoBehaviour {
	float TestValue = 5;
	private float HallWaySliderMin = 0;
	private float HallWaySliderMax = 10;
	void OnGUI(){
		MenuLabels.DinamicPositiveHorizontalSliderF("% to make fake ", ref TestValue, HallWaySliderMin, ref HallWaySliderMax, 50);
	}

I didn’t like bunch of stuff in the MainMenu code so I did this:
but ended with same stuff in MainMenu

using UnityEngine;
using System.Collections;

public class Slider {
	private string _Name;
	private float _Value;
	private bool[] _Dinamic;
	private float _SliderMin;
	private float _SliderMinValue;
	private float _SliderMax;
	private float _SliderMaxValue;
	private float _GuiWidth;
	
	/***** START CONSTRUCTORS *****/
	public Slider(string Name, float Value, bool DinamicMinSlider, float SliderMinValue, bool DinamicMaxSlider, float SliderMaxValue, float GuiWidth){
		_Name = Name;
		_Value = Value;
		_Dinamic = new bool[2] { DinamicMinSlider, DinamicMaxSlider };
		
		_SliderMin = SliderMinValue;
		if (_Dinamic[0])	{_SliderMinValue = Value * 0.9f;}
		else				{_SliderMinValue = _SliderMin;}
		
		_SliderMax = SliderMaxValue;
		if (_Dinamic[1])	{_SliderMaxValue = _Value * 1.1f;}
		else				{_SliderMaxValue = _SliderMax;}
		
		_GuiWidth = GuiWidth;
	}
	/***** END CONSTRUCTORS *****/
	
	public float HorizontalSlider(float Value){
		GUILayout.BeginHorizontal();
		GUILayout.Label(_Name + Value);
		
		_Value = GUILayout.HorizontalScrollbar(Value, 0.01f, _SliderMinValue, _SliderMaxValue, GUILayout.Width( _GuiWidth ) );
		
		GUILayout.EndHorizontal();
		
		if (_Dinamic[0]){
			if (_SliderMinValue >= _Value){
				_SliderMinValue --;
			}
			else if (_SliderMinValue <= _Value-5){
				_SliderMinValue ++;
			}
		}
		
		if (_Dinamic[1]){
			if (_SliderMaxValue <= _Value+1){
				_SliderMaxValue ++;
			}
			else if (_SliderMaxValue >= _Value+6){
				_SliderMaxValue --;
			}
		}
		return _Value;
	}
}

and I call it with:

using System;
using UnityEngine;
using System.Collections;

public class MainMenu : MonoBehaviour {
	Slider Test;
	float TestValue = 5;
	void Awake(){
		Test = new Slider("% to make fake ", TestValue, true, 0f, true, 5f, 50f);
	}
	void OnGUI(){
		TestValue = Test.HorizontalSlider(TestValue);
	}

I want your honest opinion witch way would you choose and why.

thanks in advance

Not going to read all that code to give an opinion when you don’t really have a functional problem. As a general rule use struct for stateless information, if you’re doing GUI/Menu stuff I’m guessing it’s not stateless, thus use a class.

Case in point, a gui rect has no real state from moment to moment that needs to be passed around. A window might have a rect that defines where it’s drawn on screen that changes over time but the window is a class, it’s rect property doesn’t need to have it’s own state . Here a primitive makes sense . You’d also not want to pass a reference of a window’s rect around from method to method and have it changing in lots of different places - total maintenance nightmare. If you need an external method to alter a window’s rect you’d pass it a ref to the window’s instance as this helps preserve the semantics of the information.

In determining when to use a class vs struct, just ask yourself this, do I want my object to be passed by value or reference? That’s it, then make your choice accordingly.

You are just using struct as a wrapper for static methods. You can put them in a class if you want (not going to talk about that design decision as it a separate issue which is a lot greyer than this one).

There’s absolutely no reason to use a struct here, a struct is a DATA structutre.

If you did have a data structure a good set of rules are the MSDN ones: