#Get Species Modifier
1 messages · Page 1 of 1 (latest)
my bad
what?
I didn't think it wise to try & create a thread
Why in the world would that be unwise?
I misspoke - I didn't think to be wise, etc...
I also wasn't sure about priveleges
privIleges
I created it because the main chainnel is busy. Enough about that.
okay
public void SpeciesSelect()
{
FindObjectOfType<Species>();
return;
}
Debug.Log("I found a" + <Species>)
}
thanky
Did you follow a specific tutorial to start making this?
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
Alright. I still consider myself a beginner, but I've got a decent grasp of up and down most of the time.
which way is up again?
Vector3.up
From watching your two code segments here, I'm wondering
if your approach is wise considering your experience level
do you understand Class inheritance?
yeah, no - I figured it would be a fairly simple project
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:
I see
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)
}
}
okay
but
I'm not sure if that will find objects with scripts which inherit from Species
from my trial runs, it doesn't
I recommend a different approach, until you master more concepts.
How complex is this game going to be? How many species etc?
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...
Do you know how to write OOP?
kind-of - I haven't done it for a while now
Object-Oriented Programming, by using C# Classes instead of MonoBehaviour
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
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
Try a more simple approach.
Have you made any other working scripts yet?
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
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.
it tells you how many Frames Per Second were run in the past second
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
lawdy
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.
lol
that's very reassuring
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
Alright. Good luck 👍
I hope you achieve quicker than I can