Closed jonmartincom closed 1 year ago
It should be possible to change fonts and such without changing the plugin itself. The trick is to add your own CesiumCreditSystem rather than letting Cesium add one automatically, and then modify it as necessary. So:
CesiumCreditSystem
prefab in Cesium for Unity/Runtime/Resources
in the Project tab. Drag it into your Hierarchy to add it to your scene. Update: you must also rename the prefab to exactly CesiumCreditSystemDefault
.CesiumCreditSystemUI
in the same folder. Ctrl-C to copy it, and then Ctrl-V to paste it to a folder in your project. Rename it to MyCreditSystemUI
or somesuch.CesiumCreditSystem
that you added to your scene, and in the "UI Document" component, change the "Source Asset" to point to "MyCreditSystemUI".Much appreciated, I'll follow above! thanks!
If it works for you, please close this issue.
Hopping in here. I attempted the steps listed above, but found that after Step 1 I also needed to rename the CesiumCreditSystem gameobject in my hierarchy to "CesiumCreditSystemDefault" (as CesiumCreditSystem.GetDefaultCreditSystem() is expecting this). Thank you for your help!
That does, as system was still overriding! Cheers will close!
@kring This doesn't work for me. At step 2, after copying CesiumCreditSystemUI, I'm getting lots of these errors in the Unity console:
Assets\Scripts\MyCreditSystemUI.cs(110,18): error CS0122: 'CesiumCredit' is inaccessible due to its protection level
Maybe this is because I'm using Cesium via the package manager, which probably creates a separate assembly, and CesiumCredit (and other elements CreditSystemUI uses) is marked ìnternal
?
Hmm yeah that looks like a problem @TobiasWehrum. CesiumCredit
was changed from public to internal, but it was way back before Cesium for Unity v1.0.0. So I'm not sure why this worked before and it doesn't now (and doesn't look like it should). We'll have to investigate. I'll reopen this issue and change the title accordingly.
I ended up writing a new issue instead: #437.
I think that the issue @TobiasWehrum is experiencing might be due to a misunderstanding related to step 2 in the guide @kring gave:
- Find
CesiumCreditSystemUI
in the same folder. Ctrl-C to copy it, and then Ctrl-V to paste it to a folder in your project. Rename it toMyCreditSystemUI
or somesuch.
There are two assets called CesiumCreditSystemUI
. One is the CesiumCreditSystemUI.uxml file in the .../Runtime/Resources folder, and the other is the CesiumCreditSystemUI.cs in the .../Runtime folder.
I guess that it is the CesiumCreditSystemUI.uxml file in the .../Runtime/Resources that we are supposed to duplicate and move, and not the C# file.
Thanks for the note @JakobAnarkyLabs, that's a really good point!
As the credit prefab and ui ref links are referenced in code and ui included in the package, you can't easily make changes to the text layout i.e. make it scale etc change font, as the package reverts or diallows changes (rightly) and puts the original ui back in place this means you can't easily make a new prefab or ui as far as I can see... might be being dumb here, but I couldn't figure this out.
Perhaps I take it you copy your own prefab into the heirarchy, and turn off show credits (who knows - maybe I'll try that) - (edit- Did that faced replication and other issues.)
The only way bar above is to clone package make your own git and reference that instead, awkward for updates.
Can I suggest adding a link to the credit prefab in the runtime settings scriptable object or preferably as a GameObject field in the Cesium3DTileset, so that user can specify and customise the UI easily without, going insane.
otherwise awesome product thank you cesium and google much appreciated!!