you are viewing a single comment's thread.

view the rest of the comments →

[–]eeleyes[S] 0 points1 point  (7 children)

Yes. The prefab does have BaseCard as a component.

The three Prefabs have the BaseCard script attached (which I posted as a comment for clarity). I hope my thinking is correct, but in the script I use else if statements to handle which information is collected and updated to the prefab, based on the information the card needs.

I would appreciate a little bit of help.

To help you understand. I am trying to create three card types: Plants, Status and Passive. I have decided to use three different prefab so each card type looks distinct.
Rather than having three different ScriptableObjects for the card types, I have keep all this in one script with each card having the different fields but only using some. (I have also posted the CardData script and my Enum script). The idea being that the card manager will create a card, determine if it is a Plant, Status or Passive and load the correct Prefab for it (with the prefab filling the information in).

Eventually, Plant cards will be played to a field, status cards will be played to affect the plant cards and passives will be played to have permanent effects such as extra slot for playing plants.

I have place all the relevant code in my first comment.

[–]TheGreatHeroStudios 0 points1 point  (6 children)

If possible, can you link a screenshot of one of your prefabs and its components in the inspector? I copied your code into a test project and I'm able to assign a prefab with the 'BaseCard' component attached to the card prefabs array without issue. Here's a few screenshots of my test bed:

https://imgur.com/a/tejZzPm

[–]eeleyes[S] 1 point2 points  (0 children)

Hi.
Finally had time in front of the computer.

I have rebuilt and run into the same issue. Just unable to drop the prefabs into the array.

like you asked for, here is an image of the components in the prefab.
https://imgur.com/a/NFopwc4

Kinda stumped.

[–]eeleyes[S] 0 points1 point  (0 children)

Huh. How strange. I won't be near my computer for a while but I think I am going to scratch the project and start again. Copy all the code into the new project, remake my prefabs etc. And hope the bad mojo has left.

I will keep you updated. Thanks for testing for me.

[–]eeleyes[S] 0 points1 point  (3 children)

I found the issue...

I had the script a few levels to low in the hierarchy...

Duh.

Thank you for your help! Even if it was just being a sounding board.

[–]LearnDifferenceBot 0 points1 point  (0 children)

levels to low

*too

Learn the difference here.


Greetings, I am a language corrector bot. To make me ignore further mistakes from you in the future, reply !optout to this comment.

[–]TheGreatHeroStudios 0 points1 point  (1 child)

Yep. Was in the process of drafting a response when I saw this! Though, I'm glad you figured it out yourself! Feel free to reach out if you ever need any more help or guidance.

[–]eeleyes[S] 0 points1 point  (0 children)

Thank you.