how to use ‘class’ in programming c# with unity? 1. ‘class’ that we created ( example : public class PlayerData
in PlayerData.cs. 2. ‘class’ exist in unity class library ( example : UnityEngine.Sprite ). what different between using class ? how to understand it ? what i create a ‘class’.cs for? how it work? how to learn create a class file and use it? how to use class in unity class library?
If you want to use a Class sytem in unity, you can use [System.Serializable] to make tbis happen
[System.Serializable]
public class MyClass
{
public string name;
public int number;
}
public MyClass myClass; // makes it visible in inspector
You can put this in any script (just before any methiods such as Start/Update
this might help:
if you use c#, you are always using classes. They just contain data and functions.