So I'm working on a simple drag-n-drop based trading card game for my own amusement.
There is a card inspector included.
What I want to achieve is to change values in the inspector (which has its own Inspector.cs, so I would change the variables in it) based on which card I hover over with my mouse.
Each card has its own Card.cs attached from which I want to read the values of the current card.
If I try to do this from within the Inspector.cs by something like this:
Name.text = gameobject.GetComponent<Card>().Name;, then obviously it won't work, because using gameobject in the current context is not valid.
So solution No1 would be to properly reference the gameobject over which the mouse is, which I don't know how to do.
When I try to do the same from within Card.cs, I cannot use an event trigger OnPointerEnter and run the code through that, because I have to have a reference to the gameobject that contains that function. ( And I cannot do that in a prefab, only in gameobject already existing in the level.)
So could anyone tell me how I could achieve what I want, please?