Disable Unity Debug Canvas - unity3d

For about an hour ago a Debug Canvas started Instantiating on Play.
I've searched around on the internet but can't seem to find anything.
Are there by any chance some of you who might know how to disable it as it's taking up about half of the screen?
Edit:
I tried to install the project on another computer and it doesn't show up. So idk if it has anything to do with the project or Unity itself.
Image

Add this code to one of your scripts on Awake or Start:
UnityEngine.Rendering.DebugManager.instance.enableRuntimeUI = false;
This is mentioned in documentation
You have to be on CoreRP 12 or later as mentioned here

Try Left Ctrl + Backspace to toogle it, or remove the Universal RP (Render Pipeline) package or disable it by code:
bool debugupdater_disabled = false;
private void Update()
{
if (debugupdater_disabled)
return;
GameObject debugUpdater = GameObject.Find("[Debug Updater]");
if(debugUpdater != null)
{
Destroy(debugUpdater);
debugupdater_disabled = true;
Debug.Log("done");
}
}

Related

Unity 2D Button-Image color-swap causes image to disappear

I have a function ("ChangeAudio") wherein I toggle the sounds attached to it.
The audio toggling works fine, but I also have a button in the UI that when clicked, calls the audio toggle. Again this works fine. My problem is that when the audio is toggled I've added logic to swap the color of the buttons image to show a disabled state. The swap works, I can see it swap in the inspector, but the issue is that after the first click the image is no longer visible.
Here's the function:
public void ChangeAudio() {
Audio = !Audio;
if (Audio) {
soundIMG.color = enabled_color;
}
else {
soundIMG.color = disabled_color;
}
MM.AsDie.mute = !Audio;
MM.AsJump.mute = !Audio;
}
I hope that I've given all materials needed, if not please kindly let me know.
It looks like it should be working, why are the images disappearing?
Check alpha colors in the images

Restarting carousel event paused on iPad and iPhones

I recently worked out a solution to another problem involving carousels on another post, but I found one issue when it comes to restarting the auto transitions from panel to the next on iPhones and iPads. (They won't restart.)
Here's a link to my original post and solution: Vanilla JS carousel next/prev button killing mouseover event pause
Here's a link to a JSFiddle containing my solution: https://jsfiddle.net/npzu90do/
After posting that solution I found that everything worked as it should accept the auto transition from one panel to the next stopped if you ever clicked the 'Prev' and 'Next' buttons on the sides. So I added this code to help restart the auto panel movement if you clicked outside the carousel.
document.getElementsByTagName("body").onclick = function(e) {
if(e.target != document.getElementById('carousel')) {
intervalID=setInterval(carouselPlus,speed,1)
}
}
Which works perfectly on all browsers except if you are on an iPad or iPhone.
I tried adding the following but that stopped the carousel from auto-starting due to errors in all browsers.
let touchEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
document.getElementsByTagName("body").addEventListener(touchEvent, function(e) {
if(e.target != document.getElementById('carousel')) {
intervalID=setInterval(carouselPlus,speed,1)
}
});
Any suggestions?

Memory Access Out of Bounds - WebGL

I was getting this error when I try to load my Web game:
My game is loaded at this domain:
Highest Flavor Website Link
This is my project settings at the time of build export:
Please give me some suggestion to solve this problem.
This error happened to me due to using the dynamic keyword. After replacing all my dynamic types with object the error was gone. Apparently the dynamic keyword is not supported on WebGL builds.
I've finally fixed the same error in my project. Here is what i did:
Narrow down the line of code that crashes WebGL.
Go through the painfull process of pinpointing the line of code that
is the source of the error. I had this "luck" that error occured
when I've hit button and tried to load UIScene in Addition mode. So
at first I found the script in the scene which when disabled got rid
of the crash. Then I've repeated the steps and digged deeper into
lines. After 2 hours of builds, comments etc I've found that the code
was not working was setting the new color for UnityEngine.UI.Image.
Which was pretty weird because in playmode everything worked ok.
Find solution. I think my solution might not be universal but I think there is something going in the Unity gameloop/lifecycle when running WebGL. The source of the problem was that i set the field that was storing my UI.Image in the Start method and then in some function I've tried to change the color.
Property was not exposed in inspector.
public class ModuleUI : MonoBehaviour
{
Image qualityBG;
void Start()
{
qualityBG = GetComponent<Image>();
}
...
then this line below was the cause of the crash
public void Set(Module module)
{
...
qualityBG.color = module.Quality.ToColor();
}
Fixing - so I've added [SerializeField] attribute to the field and set it up in editor, dragged the Image into the inspector slot. An it fixed it. I suspect that WebGL build might perform some methods in different order, or maybe the multipleScene loaded together might to do with it. I'm not sure but the field was not set properly with previous code fot WebGL build.
Bonus:
I've also fixed some issues that was not critical (not crushing WebGL game) but not working properly as expected in playmode. This also has got to do with trying to set some object in Start() method and then doing something on them. The collection was not set up (probably null) in WebGL.
EffectUI[] effects;
Start()
{
effects = GetComponentsInChildren<EffectUI>();
}
void HideAllEffects()
{
if (effects != null)
for (int i = 0; i < effects.Length; ++i)
effects[i].gameObject.SetActive(false);
}
And this also started working when I've added [SerializeField] to effects and hook it up in the scene...
Hope this will help some of you guys & gals!
To run this build within the web browser - I have removed all extra things related code those can't work within the web build like in-app purchase, advertisements, leaderboard, native sharing etc...
After these things code removed from the project, I uploaded the exported build content to my hosting. Then after it started working properly.

Close Unity Inside Android App

Actually I have an Android App in which I run my Unity3D game. Everything works well together. Now, when I launch Unity inside my app the game starts normally but if I try to go back to my AndroidApp intent I received a "SIGNAL 11 SIGSEGV" and Unity just close.
This happens when I'm drawing a Menu inside Unity and press "Exit" button to close Unity but if I do the same with the Android back buton Unity closes normally without problems.
I'm using plugins in Unity to achieve this behaviour.
My Function in Unity Side :
public void ExitGame()
{
#if UNITY_ANDROID
AndroidJavaClass unityPlayer = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject> ("currentActivity");
activity.Call ("ReturnToMainActivity", "Hello");
#endif
}
Function in Android Side :
public void ReturnToMainActivity (String someText)
{
Log.v("Unity", "Finish Unity from Android" );
this.mUnityPlayer.quit();
UnityPlayer.currentActivity.finish();
}
Again, this works normally if I press the Android Back Button inside Unity app but when I try to do the same with an Unity GUI.Button I received a "SIGNAL 11 SIGSEGV". In Both Cases logcat print the message "Finish Unity from Android" so I think Unity calls the function normally but in some Point just crashes.
Someone post faced the same problem but I can't figure out how he solve it.
SIGNAL 11 SIGSEGV crash Android
Ok, I just figure out how to do this.
In my function inside Android Side:
public void ReturnToMainActivity (String someText)
{
UnityPlayer.currentActivity.runOnUiThread(new Runnable(){
public void run()
{
Log.v("Unity", "Aplicacion de Unity terminada desde Android" );
ElJuegoActivity.this.mUnityPlayer.quit();
UnityPlayer.currentActivity.finish();
}
});
}
And that does the trick. No issues or problems.
NOTE: This is the "answer" the OP originally included at the end of his question. I've separated it into its own CW answer. If the OP returns and wants to post it himself, by all means ping me

How to make Vuforia stop tracking in Unity?

I've been looking for a way to stop Vuforia engine from tracking, and googleing didn't help at all.
I wanted to stop tracking when I found a tracker, and then resume trackng after an event (like a button click).
This is what I used to accomplish what you need. (:
TrackerManager.Instance.GetTracker<ImageTracker>().Stop();
TrackerManager.Instance.GetTracker<ImageTracker>().Start();
Finally Visual Studio's IntelliSense helped me with this. You can disable a tracker in a single line of code calling
TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER).Stop();
Similarly, to start it again
TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER).Start();
This code will disable the tracker
mTrackableBehaviour = GetComponent<TrackableBehaviour>();
if (mTrackableBehaviour)
{
mTrackableBehaviour.UnregisterTrackableEventHandler(this);
}
This code will enable the tracker
mTrackableBehaviour = GetComponent<TrackableBehaviour>();
if (mTrackableBehaviour)
{
mTrackableBehaviour.registerTrackableEventHandler(this);
}
only this code will enable the tracker
mTrackableBehaviour = GetComponent<TrackableBehaviour>();
if (mTrackableBehaviour){
mTrackableBehaviour.RegisterTrackableEventHandler(this);
}
May i know the reason for 2 seconds delay.the scanline delay two seconds initially during the load of the app.