0
Planowane
Version Control Integration
I currently use P4 integration built into Unity and the version control doesn't work when editing shaders. I have to manually check out the file for shader forge to be able to edit it. It would be good to have version control support.
Odpowiedź
0
Odpowiedź
Planowane
Freya Holmér (Developer) 11 lat temu
This is potentially fixed in 0.18 now, let me know if it works when it's out :)
Interesting, I haven't even thought of that. What happens when you try opening shaders?
Opening a checked in shader results in:
UnauthorizedAccessException: Access to the path "<path>\HeroCharacter.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
UnauthorizedAccessException: Access to the path "<path>\HeroCharacter.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
Ouch. Hm. I've never used an integrated Perforce in Unity before. Do you know of any links on how to deal with file access in Unity when using Perforce?
Looks like it involves the use of this API. I imagine you just need to inform it you are about to "edit" it before you attempt to save.
Looks like this is your hookup:
https://docs.unity3d.com/Documentation/ScriptReference/VersionControl.Provider.Checkout.html
https://docs.unity3d.com/Documentation/ScriptReference/VersionControl.Provider.Checkout.html
Awesome, thanks for the help finding it :)
I'll see if I can get this into 0.18, as it's quite a critical bug!
I'll see if I can get this into 0.18, as it's quite a critical bug!
Odpowiedź
Planowane
This is potentially fixed in 0.18 now, let me know if it works when it's out :)
Hello Brian!
Shader Forge 0.18 is out now, so this issue might have been fixed. Could you have a look? :)
Shader Forge 0.18 is out now, so this issue might have been fixed. Could you have a look? :)
Sorry, no luck. I opened a shader, then closed the shaderforge window and got this in the output pane.
UnauthorizedAccessException: Access to the path "<shaderpath>\Ghost.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
UnauthorizedAccessException: Access to the path "<shaderpath>\Ghost.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
And you did a clean reinstall? Removed old SF and installed the new?
Yes sir. Deleted the entire shaderforge folder and re-added from unitypackage.
What is usually involved in the process of changing a locked file?
Unlock and checkout?
Unlock and checkout?
In 0.18 I simply did checkout, but I didn't add Lock(asset, false). So I might need to first unlock, and then checkout?
Strange. Not sure what could be wrong then. I'll have to do some more research
Still not working as of Version 0.20:
STR:
1. Select Shader in Project
2. Click Open in Shader Forge
3. Move a node around.
4. Click "Compile Shader" button
5. Close ShaderForge editor.
6. Observe error in console.
7. Profit.
UnauthorizedAccessException: Access to the path "<myshaderpath>\Ghost.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
STR:
1. Select Shader in Project
2. Click Open in Shader Forge
3. Move a node around.
4. Click "Compile Shader" button
5. Close ShaderForge editor.
6. Observe error in console.
7. Profit.
UnauthorizedAccessException: Access to the path "<myshaderpath>\Ghost.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
How is your Unity version control system set up?
Could you write a step-by-step on how I would set it up and replicate it?
Could you write a step-by-step on how I would set it up and replicate it?
Surely!
1. Hit Ctrl-0 to bring up the version control window.
2. Click the settings button in the upper right to get at the settings panel.
3. Under Mode select "Perforce"
4. Enter your p4 username
5. Enter your p4 password
6. Enter your p4 workspace for your project
7. Enter your p4 server:port
8. Log Level to Info
9. Check Automatic Add
10. Do not check Work Offline
11. Asset Serialization "Force Text"
12. Default Behavior Mode 3D
13. Sprite Packer Enabled for Builds.
14. Click Connect button mid upper right.
Enjoy Perforce!
1. Hit Ctrl-0 to bring up the version control window.
2. Click the settings button in the upper right to get at the settings panel.
3. Under Mode select "Perforce"
4. Enter your p4 username
5. Enter your p4 password
6. Enter your p4 workspace for your project
7. Enter your p4 server:port
8. Log Level to Info
9. Check Automatic Add
10. Do not check Work Offline
11. Asset Serialization "Force Text"
12. Default Behavior Mode 3D
13. Sprite Packer Enabled for Builds.
14. Click Connect button mid upper right.
Enjoy Perforce!
I can't open the version control. I presume it's because I'm missing the team license?
Yes, Team License required. Perhaps Unity can extend one to you? Otherwise I think a trial Pro license will give it to you.
BTW-
UnityEditor.VersionControl.Provider.Checkout( PathToAsset(), UnityEditor.VersionControl.CheckoutMode.Both ).Wait();
This works for me for my Editor stuff.
UnityEditor.VersionControl.Provider.Checkout( PathToAsset(), UnityEditor.VersionControl.CheckoutMode.Both ).Wait();
This works for me for my Editor stuff.
Interesting. I've done pretty much the same, but I haven't done the .Wait() part. Do I have to do it in a coroutine then, or does it work in both cases?
When I call it, its just in a straight if statement off a GUI.Button() call. Works there.
I notice I have to manually check stuff out, is it supposed to be checking stuff out?
(FWIW. I use the UnityEditor.VersionControl API in my own utils )
(FWIW. I use the UnityEditor.VersionControl API in my own utils )
FWIW I just got bitten by this yet, again. Please call UnityEditor.VersionControl,Checkout() before compiling. Please! Pretty Please!
Customer support service by UserEcho