#Codex help
1 messages · Page 1 of 1 (latest)
yea, re describing the current issue is usually whats done first
well, im trying to make a Codex for my game, y'know like HollowKnight's Journal, Doom Eternal Codex
but ended up more complex than i thought, i followed a tutorial, i think you posted it i dont remember,
but now when i close the UI triggers that error
and a entry i deleted all ways of unlocking remains unlocked
this is the singleton script
https://paste.ofcode.org/3ag4DMhruDeSiXbtmYtae9h
this is the ui script
https://paste.ofcode.org/HymHAGMwqSPnPWPxfvQWm8
also here is the button script
https://paste.ofcode.org/iw9GFtAzYq3PAqPjggZAnV
SO
[CreateAssetMenu(fileName = "CassielDictando", menuName = "Cassiel/Journal Entry")]
public class CassielEntrySO : ScriptableObject
{
public Sprite Foto;
public string Nombre;
public string descripcion;
public int categoria;
}
You save and reload the data from PlayerPrefs so the first question is do you clear this when you want to clear the data?
wat
i dont, cuz i thought i didnt need it
data should go when i close the game
and then reappear when i test it again
thats why its used saving-methods, for prevent this
player prefs is persistent so it wont go away unless YOU change it
player prefs?
Do you not even know what its doing in ValeriaMemories.SaveUnlocks() ??
the preferences
oh right
holup lemme
ah yeah
i thought it was like a more polished way to save it pergame
i didnt thought would well, be permanent......
interesting...............
anyways
then what i should do?
how do i access to the playerPrefab data? i suposse it may be a database, and databases are always stored somewhere
On windows playerprefs gets stored in the registry. But if you dont want this data to be kept between game sessions just remove this code
It should be obvious
Why did you add this in the first place?
i mean, i want it to be keep between game sessions, in fact, i want other values to be kept as well
what conflicts me is, i unlocked it in a test, and now i annoying me for the testing
for the UX i want it to be permanent
for the DX
no
unity has a menu option to clear player prefs for your project
really?
so you can use that to "reset your data"
also btw, how do fully the player prefs saving works, i can save, EVERYTHING?
I forget where it is
i mean cuz also something i been trying to investigate is, how to save
is a long game
i mean, it will be
player prefs can hold the major core data types so it would be up to you to save what you need to restore game state later
its not recommended however and most people instead use something like json to save + load data.
If you wanted to release the game on steam for example and use cloud save, you would need to stop using player prefs.
ok
how json save works?
also, if i use json saves i would also have to modify this code right?
yea you would but perhaps thats too complex for you to do at this moment
ok
and if i want to sell it on itchio?
er probably fine there I don't think they have cloud saves right?
yeah
its still not great because its not easy for the general user to back up/move save files if the data is in the registry
anyway, can you paste this error you get?
MissingReferenceException: The object of type 'UnityEngine.RectTransform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
everything plz including the stack trace
ok
MissingReferenceException: The object of type 'UnityEngine.RectTransform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object+MarshalledUnityObject.TryThrowEditorNullExceptionObject (UnityEngine.Object unityObj, System.String parameterName) (at <b5bf0c891ea345fe93688f835df32fdc>:0)
UnityEngine.Bindings.ThrowHelper.ThrowNullReferenceException (System.Object obj) (at <b5bf0c891ea345fe93688f835df32fdc>:0)
UnityEngine.RectTransform.get_anchoredPosition () (at <b5bf0c891ea345fe93688f835df32fdc>:0)
UnityEngine.UI.ScrollRect.SetNormalizedPosition (System.Single value, System.Int32 axis) (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/UI/Core/ScrollRect.cs:1071)
UnityEngine.UI.ScrollRect.SetVerticalNormalizedPosition (System.Single value) (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/UI/Core/ScrollRect.cs:1055)
UnityEngine.Events.InvokableCall1[T1].Invoke (T1 args0) (at <b5bf0c891ea345fe93688f835df32fdc>:0) UnityEngine.Events.UnityEvent1[T0].Invoke (T0 arg0) (at <b5bf0c891ea345fe93688f835df32fdc>:0)
UnityEngine.UI.Scrollbar.Set (System.Single input, System.Boolean sendCallback) (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/UI/Core/Scrollbar.cs:248)
UnityEngine.UI.Scrollbar.set_value (System.Single value) (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/UI/Core/Scrollbar.cs:91)
UnityEngine.UI.ScrollRect.UpdateScrollbars (UnityEngine.Vector2 offset) (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/UI/Core/ScrollRect.cs:933)
UnityEngine.UI.ScrollRect.Rebuild (UnityEngine.UI.CanvasUpdate executing) (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/UI/Core/ScrollRect.cs:540)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/UI/Core/CanvasUpdateRegistry.cs:181)
UnityEngine.Canvas:SendWillRenderCanvases()
Huh thats not even from your code, did you destroy the scroll rect content object?
the what
i had the vertical group layout on the viewport instead on the contet
do it should be on the content?
and well, reference the content as the one with the buttons
instead of the viewport
Yes it should be on the content object
good
Content is what holds the stuff to move around in the scroll view
how i can move it
i mean, looks weird
verticall is easy, but the reason is on the right, why?
Your content object should have the Vertical layout component + Content size fitter (with vertical set to preferred size)
You should spawn the buttons as children of the content object.
i thought it did
I can't see your objects so Im just saying what It should be
for a weird reason when i put upper-center goes to center...but when i put upper-right goes to left
i mean, i can just put it to upper-center, but this is seems sus
alignment shouldnt matter if using content size fitter (which you are not)
Why do we want this? We want the content to auto size its height to fit the buttons
here incase you need a demo of how to lay out correctly @lean cape
done with unity 6
thanks :3
About your UI field , why you add serializedfield if they are already public value ? 