#[Unity Help] Rubik's Cube Auto-Solving & Prefab Reparenting Warnings"Hey everyone!

1 messages · Page 1 of 1 (latest)

grizzled pewter
#

​"Hey everyone! I'm hitting two stubborn bugs on my Rubik's Cube project and I'm stuck 😩. All my relevant code is in the GitHub Gist linked below."
​1. 👻 Critical Issue: Instant Auto-Solve
​"The game instantly solves the cube and progresses levels as soon as it loads. I believe my CubeController.IsSolved() function is being called in an Update() loop before my LevelManager coroutine finishes the scramble. I can't find the source of the early check!"

​2. ⚠️ Prefab Reparenting Warnings
​"I also get 'Setting the parent of a transform which resides in a Prefab Asset is disabled...' when the level loads. This happens during initialization in CubeController.Start() and during the layer rotation in RotateLayerCoroutine when I'm temporarily parenting pieces. Is there a better, more robust way to handle temporary reparenting of prefab instances in Unity?"
​GitHub Gist (All Code Included):

https://gist.github.com/taizeamaron-lab/b0f67b7eca6fb1b6a07190d4be3c8c9c

I don't know cooding myself i used ai till now, i want few peoples to work along my project but since they will not join unless I have something to show. So I started this with AI.
​"Thanks in advance for any eyes on this!"

Gist

Unity Rubik's Cube Debug Code - Auto-Solve and Prefab Warnings - CubeController.cs

drifting shuttle
fleet raft
#

that's also still a video of a screen instead of a screen recording

twilit palm
#

The code you sent is missing like half the functions it calls, not sure if you didn't send them or they don't exist because the AI just hallucinated them. (This is why using AI isn't a good idea, especially when you don't know how to code yourself).

Also all your variable declarations are missing from the code you sent.

I'm going to try put together a list of functions that aren't defined/shown, but I might miss some.
DetectSpacing() on line 23
In LevelManager:
StartLevel(index) on line 28
InitializeCube(index) on line 25
ScrambleCube on line 31 which you vaguely mentioned in the question, though it seems like you got ai to write that too...
LoadLevel on like 42
InitializeLevel() on line 48

If you want anyone to be able to help you, actually provide the relevant context.
As it stands, the only advice I can give to you is to start again, learn how to write code in C# (for which there are plenty of free resources available), and do it yourself.