1. So i'm not the best at c# where i get a bit confused at is a class inside the main class such as
    Code:
    class Tsuntest : RustPlugin
        {
        //a megafuckton of things that have to do with other things such as the plane.
        // BaseEntity plane = stuff; etc etc
           class Player : MonoBehaviour{
                public BasePlayer player;
                public bool inplane;
                public BaseEntity planeentity;
        }
    }
    Now where i'm confused is how can i get the plane entity from the main class to be access in the Player class.

    TLDR i want the planeentity to equal plane, but when i tried player.gameObject.AddComponent<Player>().planeentity= plane; that didn't work at all.
     
  2. Code:
    var component = player.gameObject.AddComponent<Player>();
    component.planeentity = plane;
    
     
  3. That made me more confused. (this was just to test it out)
    Why would this not work
    Code:
                var component = player.gameObject.AddComponent<Player>();
                component.planeentity = plane;
                rust.RunServerCommand("say "+player.gameObject.AddComponent<Player>().planeentity+" / "+plane);
    but this would
    Code:
                var component = player.gameObject.AddComponent<Player>();
                component.planeentity = plane;
                rust.RunServerCommand("say "+component.planeentity+" / "+plane);
     
  4. Code:
    player.gameObject.AddComponent<Player>(); // Adds the component to the player
    Player component = player.gameObject.AddComponent<Player>(); // Same as above but gives your a reference to that component
    component.planeentity = plane; // Set the field for the specified component, in this case a plane
    
    Code:
    var component = player.gameObject.AddComponent<Player>();
                component.planeentity = plane;
                rust.RunServerCommand("say "+player.gameObject.AddComponent<Player>().planeentity+" / "+plane);
    You can only add 1 instance of a specific component type to a object. If you want to get the instance of a component on a object you use GetComponent<Type>()
     
  5. That makes sense thanks a lot =)
     
  6. WTF? Why 1 instance, i have in unity more instance of specific component