|
Post by littlebatgames on Nov 18, 2023 1:01:15 GMT
Hey there, thanks for the super cool asset! It's complicated stuff but I guess that's what I need.
I'm trying to make a book that has sections, and each section can have pages added to it.
My idea is that I have fields like:
Page Section1Start; Page Section2Start; Page Section3Start;
My plan is to set base page numbers, and when pages are inserted before those Page numbers, I just increment the section start Pages.
But uh, I don't know how to get a reference to a specific page. I see GetPageData() in EndlessBook.cs, but that gets the page data, not the actual page object.
My question is, how do I get reference to specific pages, and does this seem like a good way to go about achieving my "sections" goal given how the asset works?
|
|
|
Post by echo17 on Nov 18, 2023 10:33:40 GMT
The pages are just an array of materials. So when you call GetPageData, you are just getting the material for that page. The PageData class has only one member, which is the material. I set it up this way in case I ever wanted to expand the page data to include more information than just the material, there would be no need to refactor in that case.
Similarly with AddPageData and InsertPageData, you are just setting the material (at the end of the array for AddPageData and somewhere inside the array for InsertPageData). SetPageData updates an existing index of the array. RemovePageData removes the material from the array.
So basically, to keep track of your pages, you just have to be familiar with how to manipulate arrays in C#.
|
|
|
Post by littlebatgames on Nov 18, 2023 12:58:04 GMT
Aha, cool, thank you. Seems simple enough, then! My sections will just be indexes in the array. Now to create a ton of materials!
|
|