My project is Unity in Native integration, had problem with clang error: Build failed refer image. I had gone through other sources in stack overflow to clear with clang error. I tried to remove my main.mm file, then build get succeeded but app will crash when calling unity screen. So I have to keep both files AppDelgate and main.mm file. Couldn't fix this....issue. if anyone could please..
Based on your question, hope that it's unity in swift native integration.
NOTE: This solution is only for case: Unity in Native iOS
From your screen shot it show that you are using 2 main files in Xcode. There are 2 options to fix this out.
Option 1) you may keep both files in Build Phases --> Compile sources , but in your AppDelegate, command #UIApplicationMain
import UIKit
//#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
.......................................}
This will build succeeded and unity view appears at initial stage.
Option 2) If you want to show unity view with button, Remove your main.mm file from Build Phases --> Compile sources, so app won't crash in unity view by using 'shared window appDelegate' and try this code in your AppDelegate (uncommand #UIApplicationMain)
func unityWindow() -> UIWindow? {
return UnityGetMainWindow()
}
func showUnityWindow() {
unityWindow()?.makeKeyAndVisible()
}
func hideUnityWindow() {
window!.makeKeyAndVisible()
}
then, in your View Controller
private var isShowUnityWindow = false
override func viewDidLoad()
{
super.viewDidLoad()
isShowUnityWindow = false
}
#IBAction func startUnityandHide(_ sender: UIButton)
{
isShowUnityWindow = !isShowUnityWindow
var appDelegate = UIApplication.shared.delegate as? AppDelegate
if isShowUnityWindow {
appDelegate?.unityWindow()!.frame = CGRect(x: 40, y: 200, width: 300, height: 300)
appDelegate?.showUnityWindow()
} else {
appDelegate?.hideUnityWindow()
}
}
Related
I'm taking a course for Unreal Engine 4 and I seem to have run into a compilation error.
I only have maybe 3 days experience with Unreal.
I am an expert at C++.
I have never touched C Sharp before which is why it is irritating that C Sharp is being used in small parts of the example project when I was promised that only C++ is used in Unreal Engine 4 projects.
The logfile ends as follows:
LogVSAccessor: Warning: Couldn't access Visual Studio
Candidate modules for hot reload:
BullCowGame
Launching UnrealBuildTool... [C:/Program Files/Epic Games/UE_4.22/Engine/Binaries/DotNET/UnrealBuildTool.exe -ModuleWithSuffix=BullCowGame,6263 Win64 Development -TargetType=Editor -Project="C:/Users/school/Desktop/unreal_course_projects/bull_cow_game_attempt_2/BullCowGame-starter-kit/BullCowGame.uproject" "C:/Users/school/Desktop/unreal_course_projects/bul
l_cow_game_attempt_2/BullCowGame-starter-kit/BullCowGame.uproject" -IgnoreJunk]
Warning: Starting HotReload took 1.5s.
CompilerResultsLog: New page: Compilation - May 6, 2020, 9:08:11 PM
CompilerResultsLog: Using 'git status' to determine working set for adaptive non-unity build (C:\Users\school\Desktop\unreal_course_projects\bull_cow_game_attempt_2\BullCowGame-starter-kit).
CompilerResultsLog: Creating makefile for BullCowGameEditor (game project files are newer)
CompilerResultsLog: ERROR: Could not find definition for module 'BullCowGame' (referenced via BullCowGameEditor.Target.cs)
LogMainFrame: MainFrame: Module compiling took 37.379 seconds
Warning: HotReload failed, recompile failed
LogSlate: Window 'Message Log' being destroyed
LogSlate: Window 'Message Log' being destroyed
BullCowGameEditor.Target.cs:
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class BullCowGameEditorTarget : TargetRules
{
public BullCowGameEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
ExtraModuleNames.AddRange( new string[] { "BullCowGame" } );
}
}
BullCowGame.Target.cs:
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class BullCowGameTarget : TargetRules
{
public BullCowGameTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.AddRange( new string[] { "BullCowGame" } );
}
}
The project layout:
The error I'm trying to fix: ERROR: Could not find definition for module 'BullCowGame' (referenced via BullCowGameEditor.Target.cs)
You can see this error towards the bottom of the log file.
Has anyone seen this before?
Thanks in advance
Looking at your project layout, you are missing .../Source/BullCowGame/BullCowGame.Build.cs which describes how to build the BullCowGame module.
See: https://docs.unrealengine.com/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/ModuleFiles/index.html
I've been working in Unity the last month or so. I've gotten a few iterations of a basic AR application worked up but I've updated Unity and now my code is throwing all sorts of errors.
Last week my app was working fine when building to my Pixel phone. Now that I've updated to Unity 2018.3.9, Vuforia 8.1 is now missing the name space mentioned in the title. Does anyone have any information on this?
The app will play correctly if I restart Unity up until I try to build the application to the phone. Once I build and it fails I can't replay the application due to compiler errors.
I've typed in different namespaces in the Vuforia Script and have checked my script. Mine is the same script I've used in previous versions with zero issues. I have Vuforia in the namespace but the issue appears to be coming form the Vuforia inherent script instead.
Here's the section of the Vuforia Code that appears to have the most bugs:
\\\\
namespace Vuforia.UnityCompiled
{
public class RuntimeOpenSourceInitializer
{
static IUnityCompiledFacade sFacade;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void OnRuntimeMethodLoad()
{
InitializeFacade();
}
static void InitializeFacade()
{
if (sFacade != null) return;
sFacade = new OpenSourceUnityCompiledFacade();
UnityCompiledFacade.Instance = sFacade;
}
class OpenSourceUnityCompiledFacade : IUnityCompiledFacade
{
readonly IUnityRenderPipeline mUnityRenderPipeline = new UnityRenderPipeline();
public IUnityRenderPipeline UnityRenderPipeline
{
get { return mUnityRenderPipeline; }
}
}
class UnityRenderPipeline : IUnityRenderPipeline
{
public event Action<Camera[]> BeginFrameRendering;
public event Action<Camera> BeginCameraRendering;
public UnityRenderPipeline()
\\\\\
I'm not versed enough in C# to know the fine tunings of QC'ing the code other than the immediate lack of ";" in a lot of these lines.
What the app should be doing is building correctly to my phone. Once there it's an application that reads a sketch I drew, and shows a model or several renderings of the space based on the image target and virtual buttons placed in Unity.
Hello
Not sure how you created your app, but these errors look similar to ones you'd get if there was a mismatch between the Engine SDK version and the Vuforia samples. As the SDK evolves and APIs are created/changes, so do the samples to be compatible with them. Here's how you can check the versions of both (assuming you used Vuforia samples resources):
- SDK version: Unity Editor->Window->Vuforia Configuration.
- Samples version: Unity Editor->Project window: Assets/Vuforia/version.
also, you can delete the old version of Vuforia and re-import from the Package Manager in Unity.
Thanks,
.
I have already imported the Unity Free integration for Oculus package through Assets -> Import Package but I still get the following error message when I run a simple program:
DllNotFoundException: Exception of type 'System.DllNotFoundException' was thrown.
Ovr.Hmd.Detect () (at Assets/OVR/Scripts/OvrCapi.cs:1361)
I don't actually have an Oculus hooked up, and the code snippet that checks this is the following:
void Start()
{
if ( Ovr.Hmd.Detect() > 0 )
{
Debug.Log( "Oculus Rift HMD detected! " + OVRManager.capiHmd.GetString( Hmd.OVR_KEY_USER, "" ) );
}
else
{
Debug.Log( "No Oculus Rift detected..." );
}
}
Line 1361 that the err msg is pointing at is the following:
public static int Detect()
{
return ovrHmd_Detect();
}
But when I replace Ovr.Hmd.Detect() with ovrHmd_Detect() it is highlighted red.
What am I doing wrong?
.
Well as the error message states, you are missing a dll. Which suggest to me that you did not correctly import the package.
When you import the OculusUnityIntegration.unitypackage into your Unity project you should end up with some files in the Assets/Plugins folder, one of which is the OculusPlugin.dll. Which in this case seems to be the one you are missing
Try re-importing the package and make sure you have all items. You can follow this step by step guide
Just build the application with Architecture "x86_64":
I have been trying to communicate with my Unity C# script through my Android Application using
"UnityPlayer.UnitySendMessage("Cube", "Test","HELLO") - where "Cube" is my Unity Object, "Test" is the name of the method present in the C# script it is using and "HELLO" is the message String I want to pass.
This line is placed in my onClick function, like this:
ImageButton right_button = (ImageButton) findViewById(R.id.right_arrow);
right_button.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
UnityPlayer.UnitySendMessage("Cube", "Test","HELLO");
}
});
But when I run my android application and as soon as I click this button, I get this error:
09-11 14:22:37.526: E/AndroidRuntime(1330): java.lang.NoClassDefFoundError: com.unity3d.player.UnityPlayer
I have included classes.jar in my build path also.
Is there anything else I am missing out?
Thanks in advance!
Check if the class.jar file is in the Build Path of your Project. And if so, check if it is selected (check box is marked).
Tip: if you get ClassDefNotFound runtime errors (or similar), you might need to perform this extra step:
go to Project > Properties > Java Build Path -> Order and Export tab and check (tick) the classes.jar, Android x.y and Android Dependencies items; then Apply and rebuild the probject.
Happened to me the other time too.
I clean, re-link and rebuild my eclipse project. Re-Export my jar file to unity and also restart Unity. Build again and the error is gone.
Im writing a policy plugin for VS which checks several issues with the code. If an issue occurs it will be displayed in the policy warnings tab. Now I want to jump to the line where the issue occurs in the editor when I double click it in the policy warning tab. How can I do that?
namespace PolicyPlugin
{
[Serializable]
public class MyPolicyPlugin : PolicyBase
{
//...
//called if the user clicks on a policy warning
public override void Activate(PolicyFailure failure)
{
// make jump to line x
}
}
}
Thanks!
You could try to get DTE automation object first:
EnvDTE.DTE dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE));
or use alternative ways to get it.
An then execute standard command (that's what happens when you press CTRL+G in Visual Studio)
DTE.ExecuteCommand("Edit.Goto", "1234")
Note: I'm not sure about exact ExecuteCommand method signature. Also you can manipulate IDE the same way for other commands.