Character List?

(Francois) #1

Hey Guys,

Quick question? Is there a way to get a list of existing characters?


(Francois) #2

I take it that this is not possible?

(Bata Laki) #3

Hi there.
I think it is possible…
You just need to access all of the objects with some sort of raycast and retrieve all of they game objects, then check are they are Player or NPC and if they are add them to a list… Use tags since actor component can be attached for more types then only characters.
The problem is that you will have to run always a filter function all over again for different scenes since as i understood are not Serializable Objects in ply. So u will have to set extern object type which can set dirty all of objects in list and then again retrieve it upon loading.

There is a way even go get all character objects from DataFolder but again its a lot of programing involved…
Can u elaborate more on why u need it and what u had in mind? Maybe i can made some additional plyblox in taht purposes.


(Francois) #4

Hey Bata,

Thanks for the reply.

So I have a character selection and create character screen, from here the user does what the screens imply and loads their game.

I must also state that I am coding this and not using plyGame.


(Bata Laki) #5

Hey Storm…
First i must say that this is plyForum so asking here for a help outside a plygame is not too much helpful i think. :slight_smile: U would have more luck on some C# programing based sites.
Personaly i go more with hash and Dicts. But of course that you can create List.(Along with ur serialization system(JSON is best for me))
You need ofc one other button manager class which will have public static int counter;
when u have static int all other button classes will change taht same value OnClick(); you just need to subscribe events for each one separatly amd derive them from your ButtonManager class whaich will change this.counter.
u can use even like this ListOFChars[mybutonclas.counter] or you can jsut fetch reference of ur list and do it taht way.
to get taht data beside your :

public CharacterClass{
public string name; etc
u need as well
public CharacterArrayClass{
public List chars;
serialize your CharacterArrayClass and use CharacterClass for retrieval of data.

I am not sure are you looking for idea or actual way how to do it tho, so i dont know how helpfull this will be to you… :slight_smile:


(Francois) #6

Cheers Thanks!