#Get Species Modifier

1 messages · Page 1 of 1 (latest)

obsidian ingot
devout niche
#

my bad

obsidian ingot
#

what?

devout niche
#

I didn't think it wise to try & create a thread

obsidian ingot
#

Why in the world would that be unwise?

devout niche
#

I misspoke - I didn't think to be wise, etc...

#

I also wasn't sure about priveleges

#

privIleges

obsidian ingot
#

I created it because the main chainnel is busy. Enough about that.

devout niche
#

okay

obsidian ingot
#
public void SpeciesSelect()
    {
        FindObjectOfType<Species>();
        return;
    }
    Debug.Log("I found a" + <Species>)
}
devout niche
#

thanky

obsidian ingot
#

Did you follow a specific tutorial to start making this?

devout niche
#

nope; I did a bit of coding a decade ago, and I've just been pottering around with modifying tutorials I was following online

#

I haven't been working on it very long

obsidian ingot
#

Alright. I still consider myself a beginner, but I've got a decent grasp of up and down most of the time.

devout niche
#

which way is up again?

obsidian ingot
#

Vector3.up

devout niche
#

sorry - troll reflexes

#

aha

obsidian ingot
#

From watching your two code segments here, I'm wondering

#

if your approach is wise considering your experience level

#

do you understand Class inheritance?

devout niche
#

yeah, no - I figured it would be a fairly simple project

obsidian ingot
#

I'd avoid inheritance, as it can quickly get complicated.
But for Species and Subspecies, it should be okay, if you know how it works.
I have avoided it, so I am not certain 🤷‍♂️

#

But

#

In your last code segment, the small one

#
public void SpeciesSelect()
    {
        FindObjectOfType<Species>(); // This function runs, but does not return its results to any variable
        return; // This is only necessary for fields with a Data return type, such as string, int, float, GameObject
    }
    Debug.Log("I found a" + <Species>) // This is being run outside the void, in the Class declaration, it is wrong
}
Debug.Log("I found a" + <Species>) // <Species> is not a valid syntax, and even if it is or was, it has to be input as a string, like with a ToString() extension
#

the correct approach would be:

devout niche
#

I see

obsidian ingot
#
public void SpeciesSelect()
    {
        Species found = FindObjectOfType<Species>(); // this is also correct
        var found = FindObjectOfType<Species>(); // Returns the first of its type found in the scene
        Debug.Log("I found a" + found.gameObject.name)
    }
}
devout niche
#

okay

obsidian ingot
#

but

#

I'm not sure if that will find objects with scripts which inherit from Species

devout niche
#

from my trial runs, it doesn't

obsidian ingot
#

I recommend a different approach, until you master more concepts.
How complex is this game going to be? How many species etc?

devout niche
#

I'm thinking if it did I'd be getting some kind of result from the code
funnily, I don't get compile errors tho

8 species, each species has a number of clans, it kind-of gets out of hand until I reach astroScores & later

#

I think the pinned tutorials will help a lot more than just typing & hoping for the best...

obsidian ingot
#

Do you know how to write OOP?

devout niche
#

kind-of - I haven't done it for a while now

obsidian ingot
#

Object-Oriented Programming, by using C# Classes instead of MonoBehaviour

devout niche
#

I'd like to change my answer to a distinct 'no'

#

I can get the base scores to register in-game, but after that I come unstuck

obsidian ingot
#

You can achieve the same results.
ScriptableObjects are better in the long run, because with the correct approach each script becomes a module you can fit into any of your future games, with minimal modifications.

I've tried to get into SOs before, and I use them for some Editor stuff, but beyond that I just need to walk the path until it starts making sense for me to use them

obsidian ingot
devout niche
#

I'll race you to understanding better
not really - it's the only part of a project that I consider relevant at this point
I'm not even sure what I'm going to do with it if I get it completed

#

I think I'll have a go at the pinned tutorials to get a bit of a grip on what I should be doing
you've been most helpful; thankyou for your time & patience

obsidian ingot
#

Alright. That's a good idea.
Once you start learning and understanding how to use the tools provided, you'll soon get ideas of things to create.

#

I made an FPS counter the other day, no tutorial needed. Just a good day's work.

devout niche
#

counter?

#

like a scoreboard?

obsidian ingot
#

it tells you how many Frames Per Second were run in the past second

devout niche
#

I see

#

oh - I almost thought you meant "First Person Shooter" 😛

obsidian ingot
#

Although I also have a tendency to do... stupid things lol.
I secured it to never exceed it's data type maxValue
but then I realized it would take 68 years for the int to reach max, and 10.000 trillion trillion years of 1.000 FPS 😂 for the float

devout niche
#

lawdy

obsidian ingot
#

so when the stars are all but burned out, and the universe is a cold graveyard, you can be sure, whatever computer was running my FPS counter, would not return an error.

devout niche
#

lol
that's very reassuring

obsidian ingot
#

Do you want to know how to make one?

#

more simple than mine, ofc

devout niche
#

almost a pity that no-one would be around to witness it

#

I don't think I need one right now; it would just be another distraction from my own path - but thanks for the offer

obsidian ingot
#

Alright. Good luck 👍

devout niche
#

I hope you achieve quicker than I can