#DDOL help
1 messages · Page 1 of 1 (latest)
Ok, so why can't you use DDOL as I mentioned?
I'm still very new so if i'm misunderstanding I'm sorry. So I tried looking into how to get it to work and did some research by watching a couple videos and searching around unity forums but most of the tuts basically just go from character creation screen into level. I have several scenes between my Char Customization and say Level one, such as menus and such. As i said I'm still very new to unity in general so my grasp and understanding is definitely a little poor. From my understanding, say I have my char customization screen with one character. You go through, customize the Head/Body/Color and you load into the next scene and there's 5 units that are supposed to be your custom character. how would I go about getting those variable (what is enabled/disabled on my player character) and transferring them over to another unit that is using the same model. I'm not sure if i'm explaining it well. Would I keep the object with the customization manager with all the lists and such and reference it in other scripts? Or would I be able to reference that gameObject itself? I'm just a bit confused on this part and it's been driving me crazy the past couple days haha
I can send the script for my customization manager if that would help you understand a bit better what I'm working with?
The way I'd do it is have a DDOL GameManager script that is persistent between scenes. Then it can reference some additional managers or global data objects, like InventoryManager/CharacterMananger.
Then I'd just save the indexes of the selected character models in the CharacterManager, and use them when I need them to instantiate new characters.
So the script game manager would reference my character customization manager script - and have it save the customization? I’m not quite sure how to do that - like what would I need to reference in the GameManager script? Like say I had a prefab with all the objects attached to my character, how would I get the same values over from the script?
My Customization Manager
That's what my script is but was too long to copy into here
You can ignore the playerprefs stuff I was trying to figure it out watching a tut earlier but couldn’t figure it out - forgot to remove before sending
check #854851968446365696 on how to share big blocks of code.
Oops sorry I’ll correct that one moment
Thanks for being so patient by the way, I appreciate your help immensely
Ugghhh... It's painful to look at that code, but ok.😅
I know dude I’m so sorry 😂
I’m trying my best man this is literally my first project - I’m super passionate about it just not as knowledgeable
For starters, I'd separate data and logic from actual display.
Something like this:
//write a similar method for bodies and materials. In Materials iterate the renderers list instead of referencing each separately.
//Call from a button with int parameter == +1 or -1 to iterate forward/backwards
public void IterateHead(int iterator)
{
headSelectionIndex += iterator;
if(headSelectionIndex >= heads.Count)
headSelectionIndex = 0;
else if(headSelectionIndex < 0)
headSelectionIndex = heads.Count - 1;
GameManager.selectedHead = headSelectionIndex;
UpdateView();
}
public void UpdateView()
{
foreach(var head in heads)
head.SetActive(false);
head[headSelectionIndex].SetActive(true);
//Repeat for bodies
}
//In your character spawn script in the right scene:
private void Start()
{
SpawnCharacter();
}
private void SpawnCharacter()
{
int headIndex = GameManager.selectedHead;
//same for body;
//Then instantiate a character template and assign the correct head/body models
}
This looks perfect. So would the IterateHead/UpdateView be in my CustomizationController or are those meant to be added separately to the GameManager? Or would the CustomizationController be the GameManager? And finally how would I go about instantiating an object with those preferences? Would I make a list referencing the heads/bodies of the prefab object on screen and doing something like the UpdateView in the first script using head[headIndex].SetActive(true);?
You can keep it the way it is now, just replace Al of the plus/minus methods with iteration methods similar to what I've shown.
And when instantiating the character, there are multiple ways to go about it. You could do it the same way you do in the character selection scene, but I'd just have a list of head/body meshes/prefabs on either a DDOL object(maybe GameManager, but not adviced), or the character spawner script, and select the models/prefabs from that list based on the index. Then either set them to the mesh filters or instantiate as gameobjects based on whatever you store in the list.