I would like to store an object in a struct. This is what I have so far:
struct sectionData
{
unsigned int currentSectionNumber;
unsigned int currentObjNum;
unsigned int sectionNumberToGoIn;
int camFocus;
Object obj; // this is the object i want to store in the struct. how to do it?
};
// apply info
sectData.currentSectionNumber = 1;
sectData.currentObjNum = 20;
sectData.sectionNumberToGoIn = 0;
sectData.camfocus = 1;
sectData.Object = gameObject; // ?? not sure what to do here
Storing an object type in a struct in C++ works exactly like you would use an int or any primitive. You would reference the member object with the object name rather than the type name. Since you decided to call your Object instance obj. sectData's member Object would be referred to as sectData.obj for reading, writing, forming references and so on.
Storing an object type in a struct in C++ works exactly like you would use an int or any primitive. You would reference the member object with the object name rather than the type name. Since you decided to call your Object instance obj. sectData's member Object would be referred to as sectData.obj for reading, writing, forming references and so on.
Thanks. That worked!
I thought I already tried that but I guess I didn't. :/