Search Unity

Question Regarding referencing other classes - Unity Lesson - Rubys Adventure 2d

Discussion in 'Community Learning & Teaching' started by ArchwayJay, Feb 22, 2023.

  1. ArchwayJay

    ArchwayJay

    Joined:
    Jun 12, 2022
    Posts:
    1
    Not sure if anyone can help with this. My code is all working fine , I just want to find out why we use ScriptName and then variable = other.getComponent.

    For example see below ;

    RubyController player = other.gameObject.GetComponent<RubyController>(); 


    Why do we need the class RubyController , are we not getting the ruby controller script in the get component part?

    Thanks !