silverua / slay-the-spire-map-in-unity

Implementation of the Slay the Spire Map in Unity3d
MIT License
273 stars 65 forks source link

Use DestoyImmediate? #31

Open jmeyer1980 opened 4 months ago

jmeyer1980 commented 4 months ago

I tried to use that (since the error recommends it) but things stopped working. I am not a programmer. I use the AIs like Gemini and Bing Notepad (a new feature, if you haven't seen it, it is really nice.) Anyhow, the error:

Destroy may not be called from edit mode! Use DestroyImmediate instead.
Destroying an object in edit mode destroys it permanently.
UnityEngine.Object:Destroy (UnityEngine.Object)
Map.MapViewUI:ClearMap () (at Assets/STSMap/Scripts/MapViewUI.cs:35)
Map.MapView:ShowMap (Map.Map) (at Assets/STSMap/Scripts/MapView.cs:88)
Map.MapManager:GenerateNewMap () (at Assets/STSMap/Scripts/MapManager.cs:44)
Map.MapManagerInspector:OnInspectorGUI () (at Assets/STSMap/Scripts/Editor/MapManagerInspector.cs:18)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
jmeyer1980 commented 4 months ago

And sorry that I am blowing up the notifications. lol.

silverua commented 4 months ago

Hmmm. Good catch. I have not intended for that button to be used like that, so maybe some safety is required there. I've only intended for it to be used during runtime to re-generate the map. It does the same exact thing that the Generate button in the corner of the screen in Play mode does.

The idea of this asset is that you do not need to pre-generate the map into the scene in Edit mode. You edit the MapConfig scriptable object, then as you run the game, the map will be automatically generated in Start(). So, in order to use the asset properly, you do not need to press the Generate button in the Inspector of MapManager while not in Play mode (or even at all).

jmeyer1980 commented 4 months ago

Ah. Ok. Hence why the Gamevanilla’s version has no generator editor button. I’ve been using the generator button to show me the window size and such.

I have been getting into weird situations where it suddenly claims that the circle color something is null and won’t generate anything but one node. I can never seem to replicate it consistently, however… so kinda hard to help pinpoint it without running record on my desktop the entire time I am messing with Unity. Lol. Like that will happen. =p

I will say that it usually seems to happen after I have edited all of the nodes and then I am never able to figure out what’s going on. I will start another issue if I can replicate it.

Cheers!

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows


From: Vladimir Limarchenko @.> Sent: Monday, March 4, 2024 7:31:34 PM To: silverua/slay-the-spire-map-in-unity @.> Cc: Bellok @.>; Author @.> Subject: Re: [silverua/slay-the-spire-map-in-unity] Use DestoyImmediate? (Issue #31)

Hmmm. Good catch. I have not intended for that button to be used like that, so maybe some safety is required there. I've only intended for it to be used during runtime to re-generate the map. It does the same exact thing that the Generate button in the corner of the screen in Play mode does.

The idea of this asset is that you do not need to pre-generate the map into the scene in Edit mode. You edit the MapConfig scriptable object, then as you run the game, the map will be automatically generated in Start(). So, in order to use the asset properly, you do not need to press the Generate button in the Inspector of MapManager while not in Play mode (or even at all).

— Reply to this email directly, view it on GitHubhttps://github.com/silverua/slay-the-spire-map-in-unity/issues/31#issuecomment-1977728660, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEFWPWL6G46CMMNMRP6KX3YWUG6NAVCNFSM6AAAAABEGBA3N6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZXG4ZDQNRWGA. You are receiving this because you authored the thread.Message ID: @.***>